SlideShare una empresa de Scribd logo
1 de 34
FLEX / JEE José Luis Coronel Cortes Arquitecto Tecnológico BEE Concretorías y Sistemas
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Agenda
[object Object],[object Object],[object Object],Introducción
[object Object],[object Object],[object Object],[object Object],[object Object],FLEX
[object Object],[object Object],[object Object],[object Object],[object Object],Data Services
Flex - BlazeDS Flash Player AIR Servidor JEE Flex BlazeDS Servicios WEB Servicios HTTP Objetos Remotos Servicio Mensajería Servicios WEB Servicios HTTP Objetos Remotos Servicio Mensajería
Flex - BlazeDS web.xml MessageBroker Servlet services-config.xml messaging-config.xml proxy-config.xml remoting-config.xml Factoria
Flex - BlazeDS BlazeDS Servicio Factoria Spring DAO Hibernate Ibatis
Objetos Remotos ,[object Object],[object Object],[object Object],[object Object],Cliente Servidor RemoteObject Java Request (AMF) ResultEvent / FaultEvent
Objetos Remotos Cliente Servidor remoting-config.xml Request ResultEvent RemoteObject Button DataGrid Handler ProductoServicio ProductoDAO
Objetos Remotos Java public class ProductoServicio{ public Producto getProductoPorId(int productoId) throws Exception{ return productoDao.getProductoPorId(productoId); } public List getListadoProductos(){ return productoDao.getListadoProductos(); } } Servidor ProductoServicio ProductoDAO
Objetos Remotos  remoting-config.xml <destination id=“ productoServicio ”> <properties> <source> cl.jug.ProductoServicio </source> <scope> application </scope> </properties> </destination> Servidor ProductoServicio ProductoDAO remoting-config.xml
Objetos Remotos  MXML / ActionScript <mx:RemoteObject  id=&quot; miServicio ” destination=“ productoServicio ”  result=&quot; resultadoHandler(event) ”  fault=“ errorHandler(event) &quot;/> import mx.rpc.remoting.RemoteObject; var miServicio : RemoteObject = new RemoteObject(); miServicio.destination = “productoServicio&quot;; miServicio.addEventListener(&quot;result&quot;, resultadoHandler); miServicio.addEventListener(&quot;fault&quot;, errorHandler); Cliente RemoteObject
Objetos Remotos  Button <mx:Button label=“ Listado Productos ” c lick=&quot; miServicio.getListadoProductos() &quot;/> <mx:Button label=“ Producto por Id ” click=“ miServicio. getProductoPorId (32) &quot;/> Cliente RemoteObject Button
Objetos Remotos  DataGrid <mx:DataGrid dataProvider=&quot;{ miServicio.getListadoProductos.lastResult }&quot;/>
Objetos Remotos  Handler [Bindable] private var productos : ArrayCollection; private function resultadoHandler(evento : ResultEvent) : void { productos = evento.result as ArrayCollection; }
Objetos Remotos  Métodos en el RemoteObject <mx:RemoteObject  id=&quot; miServicio ” destination=“ productoServicio ” fault=&quot; faultHandler(event) “> <mx:method name=&quot; getListadoProductos ”  result=“ listadoHandler(event) &quot;/> <mx:method name=&quot; getProductoPorID ”  result=“ productoHandler(event) &quot;/> </mx:RemoteObject>
Objetos Remotos  AS3 / Java ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Servicio de Mensajería ,[object Object],[object Object],[object Object],[object Object],[object Object],Data Data Channel Channel Destination
Servicio de Mensajería Adaptadores ,[object Object],[object Object],[object Object],[object Object]
Servicio de Mensajería Cliente Servidor Producer Consumer Button Handler messaging-config.xml
Servicio de Mensajería Destination <destination id=“ clientes ”> <channels> <channel ref=“ my-polling-amf ”/> </channels> </destination> <destination id=“ destinoStream ”> <channels> <channel ref=“ my-streaming-amf ”/> </channels> </destination> Servidor Messaging-config.xml
Servicio de Mensajería Producer <mx:Producer id=“ productor ” destination=“ clientes &quot;/> Cliente Producer
Servicio de Mensajería Producer import mx.messaging.messages.AsyncMessage; var mensaje : AsyncMessage = new AsyncMessage(); mensaje.headers.user = “usuario”; mensaje.body = “Mensaje a enviar”; productor.send(mensaje); Cliente Producer Button
Servicio de Mensajería Consumer ,[object Object],[object Object],[object Object],[object Object],[object Object],Cliente Producer Button Consumer
Servicio de Mensajería Handler import mx.controls.Alert; private function mensajeHandler(evento : MessageEvent) : void { Alert.show(evento.message.body as String,  “ Mensaje recibido desde el usuario : &quot;  + evento.message.headers.user); } Cliente Producer Button Consumer Handler
Servicio de Mensajería Subtopic Cliente 1 Cliente2 Componente A Componente B Componente A Componente B Servidor Topic Subtopic_A Subtopic_B
Servicio de Mensajería Subtopic private function iniciarAplicacion() : void{ consumidor.subtopic = “chat.cliente1“; consumidor.subscribe(); } private function enviarMensaje(texto : String) : void{ var mensaje : IMessage = new AsyncMessage(); mensaje.headers = new Array(); mensaje.body.mensajeChat = texto; producidor.subtopic = &quot;chat.cliente1“; producidor.send(mensaje); }
Servicio de Mensajería Subtopic – message-config.xml <destination id=&quot; chat “> <properties> <network> <session-timeout> 0 </session-timeout> </network> <server> <max-cache-size> 1000 </max-cache-size> <message-time-to-live> 0 </message-time-to-live> <durable> false </durable> <allow-subtopics> true </allow-subtopics> <subtopic-separator> . </subtopic-separator> </server> </properties> </destination>
Servicio de Mensajería Selector private function iniciarAplicacion() : void{ consumidor.selector = &quot;propiedad1> 30“; consumidor.subscribe(); } private function enviarMensaje(valor : int, texto : String) : void{ var mensaje:IMessage = new AsyncMessage(); mensaje.headers = new Array(); mensaje.headers[&quot;propiedad1&quot;] = valor; mensaje.body.mensajeChat= texto; productor.send(mensaje); }
Servicio de Mensajería Java - Header AsyncMessage mensaje = new AsyncMessage(); mensaje.setDestination(“chat&quot;); mensaje.setClientId(clienteId); mensaje.setMessageId(UUIDUtils.createUUID(false)); mensaje.setTimestamp(System.currentTimeMillis()); mensaje.setBody(“Hola Mundo!!”); Map map = new HashMap(); map.put(&quot;propiedad1&quot;, &quot;5&quot;); mensaje.setHeaders(map); mensajeBroker.routeMessageToService(mensaje, null);
Servicio de Mensajería JMS – message-config.xml <destination id=“chat-topic-jms“> <properties> <server> <durable> false </durable> <durable-store-manager> flex.messaging.durability.FileStoreManager </durable-store-manager> </server> <jms> <destination-type> Topic </destination-type> <message-type> javax.jms.ObjectMessage </message-type> <connection-factory> jms/flex/TopicConnectionFactory </connection-factory> <destination-jndi-name> jms/topic/flex/FlexChatTopic </destination-jndi-name> <delivery-mode> NON_PERSISTENT </delivery-mode> <message-priority> DEFAULT_PRIORITY </message-priority> <acknowledge-mode> AUTO_ACKNOWLEDGE </acknowledge-mode> <transacted-sessions> false </transacted-sessions> </jms> </properties> <channels> <channel ref=&quot;my-polling-amf&quot;/> </channels> <adapter ref=&quot;jms&quot;/> </destination>
DEMOSTRACION
¿PREGUNTAS?

Más contenido relacionado

Destacado

Desarrollo para iPhone con Flash
Desarrollo para iPhone con FlashDesarrollo para iPhone con Flash
Desarrollo para iPhone con FlashEdgar Parada
 
The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...Brian Solis
 
Open Source Creativity
Open Source CreativityOpen Source Creativity
Open Source CreativitySara Cannon
 
Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)maditabalnco
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsBarry Feldman
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome EconomyHelge Tennø
 

Destacado (6)

Desarrollo para iPhone con Flash
Desarrollo para iPhone con FlashDesarrollo para iPhone con Flash
Desarrollo para iPhone con Flash
 
The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...
 
Open Source Creativity
Open Source CreativityOpen Source Creativity
Open Source Creativity
 
Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post Formats
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome Economy
 

Similar a JUG DAY FLEX / JEE

Flex Camp 2008. Ricardo Poblete
Flex Camp 2008. Ricardo PobleteFlex Camp 2008. Ricardo Poblete
Flex Camp 2008. Ricardo Pobleteripoblet
 
2015 10 - Curso Cliente @firma INAP día 2
2015 10 - Curso Cliente @firma INAP día 22015 10 - Curso Cliente @firma INAP día 2
2015 10 - Curso Cliente @firma INAP día 2Tomás García-Merás
 
Appcircus Academy: Integración de Social Media en Android
Appcircus Academy: Integración de Social Media en AndroidAppcircus Academy: Integración de Social Media en Android
Appcircus Academy: Integración de Social Media en AndroidAlberto Ruibal
 
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8Sorey García
 
Microsoft Asp. Net [Asp.Net - Parte 2]
Microsoft Asp. Net [Asp.Net - Parte 2]Microsoft Asp. Net [Asp.Net - Parte 2]
Microsoft Asp. Net [Asp.Net - Parte 2]Antonio Torres
 
Introducción ASP .NET
Introducción ASP .NET Introducción ASP .NET
Introducción ASP .NET Universidad
 
Presentacion Tesis
Presentacion TesisPresentacion Tesis
Presentacion TesisGEOVAN21
 
Building Ria Applications With Silverlight 2
Building Ria Applications With Silverlight 2Building Ria Applications With Silverlight 2
Building Ria Applications With Silverlight 2Tonymx
 
Proyecto sicosetec 3 ra parcial final Esteban Maldonado
Proyecto sicosetec 3 ra parcial   final Esteban MaldonadoProyecto sicosetec 3 ra parcial   final Esteban Maldonado
Proyecto sicosetec 3 ra parcial final Esteban MaldonadoEsteban Maldonado
 
Proyecto sicosetec 3ra parcial (corregido) esteban maldonado
Proyecto sicosetec 3ra parcial (corregido)   esteban maldonadoProyecto sicosetec 3ra parcial (corregido)   esteban maldonado
Proyecto sicosetec 3ra parcial (corregido) esteban maldonadoEsteban Maldonado
 
Proyecto sicosetec 3ra parcial (corregido) Esteban Maldonado
Proyecto sicosetec 3ra parcial (corregido)   Esteban MaldonadoProyecto sicosetec 3ra parcial (corregido)   Esteban Maldonado
Proyecto sicosetec 3ra parcial (corregido) Esteban MaldonadoEsteban Maldonado
 
Efc programación .net-luis fernando aguas - 22012022 1700
Efc programación .net-luis fernando aguas - 22012022 1700Efc programación .net-luis fernando aguas - 22012022 1700
Efc programación .net-luis fernando aguas - 22012022 1700Luis Fernando Aguas Bucheli
 
Tema5 3.jsf
Tema5 3.jsfTema5 3.jsf
Tema5 3.jsfjaiverlh
 
Servicio web
Servicio web Servicio web
Servicio web Yael67
 

Similar a JUG DAY FLEX / JEE (20)

Flex Camp 2008. Ricardo Poblete
Flex Camp 2008. Ricardo PobleteFlex Camp 2008. Ricardo Poblete
Flex Camp 2008. Ricardo Poblete
 
Servicios web
Servicios webServicios web
Servicios web
 
2015 10 - Curso Cliente @firma INAP día 2
2015 10 - Curso Cliente @firma INAP día 22015 10 - Curso Cliente @firma INAP día 2
2015 10 - Curso Cliente @firma INAP día 2
 
Appcircus Academy: Integración de Social Media en Android
Appcircus Academy: Integración de Social Media en AndroidAppcircus Academy: Integración de Social Media en Android
Appcircus Academy: Integración de Social Media en Android
 
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
 
Introduccion a Android
Introduccion a AndroidIntroduccion a Android
Introduccion a Android
 
Microsoft Asp. Net [Asp.Net - Parte 2]
Microsoft Asp. Net [Asp.Net - Parte 2]Microsoft Asp. Net [Asp.Net - Parte 2]
Microsoft Asp. Net [Asp.Net - Parte 2]
 
Introducción ASP .NET
Introducción ASP .NET Introducción ASP .NET
Introducción ASP .NET
 
Presentacion Tesis
Presentacion TesisPresentacion Tesis
Presentacion Tesis
 
Web services
Web services Web services
Web services
 
GWT - Una introducción
GWT - Una introducciónGWT - Una introducción
GWT - Una introducción
 
Building Ria Applications With Silverlight 2
Building Ria Applications With Silverlight 2Building Ria Applications With Silverlight 2
Building Ria Applications With Silverlight 2
 
Servicios web
Servicios webServicios web
Servicios web
 
Proyecto sicosetec 3 ra parcial final Esteban Maldonado
Proyecto sicosetec 3 ra parcial   final Esteban MaldonadoProyecto sicosetec 3 ra parcial   final Esteban Maldonado
Proyecto sicosetec 3 ra parcial final Esteban Maldonado
 
Proyecto sicosetec 3ra parcial (corregido) esteban maldonado
Proyecto sicosetec 3ra parcial (corregido)   esteban maldonadoProyecto sicosetec 3ra parcial (corregido)   esteban maldonado
Proyecto sicosetec 3ra parcial (corregido) esteban maldonado
 
Proyecto sicosetec 3ra parcial (corregido) Esteban Maldonado
Proyecto sicosetec 3ra parcial (corregido)   Esteban MaldonadoProyecto sicosetec 3ra parcial (corregido)   Esteban Maldonado
Proyecto sicosetec 3ra parcial (corregido) Esteban Maldonado
 
Efc programación .net-luis fernando aguas - 22012022 1700
Efc programación .net-luis fernando aguas - 22012022 1700Efc programación .net-luis fernando aguas - 22012022 1700
Efc programación .net-luis fernando aguas - 22012022 1700
 
Ajax
AjaxAjax
Ajax
 
Tema5 3.jsf
Tema5 3.jsfTema5 3.jsf
Tema5 3.jsf
 
Servicio web
Servicio web Servicio web
Servicio web
 

Último

Redes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfRedes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfsoporteupcology
 
La era de la educación digital y sus desafios
La era de la educación digital y sus desafiosLa era de la educación digital y sus desafios
La era de la educación digital y sus desafiosFundación YOD YOD
 
Proyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptxProyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptx241521559
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricKeyla Dolores Méndez
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan JosephBRAYANJOSEPHPEREZGOM
 
Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíassuserf18419
 
Plan de aula informatica segundo periodo.docx
Plan de aula informatica segundo periodo.docxPlan de aula informatica segundo periodo.docx
Plan de aula informatica segundo periodo.docxpabonheidy28
 
International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)GDGSucre
 
KELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento ProtégelesKELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento ProtégelesFundación YOD YOD
 
9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudiante9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudianteAndreaHuertas24
 
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...silviayucra2
 
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE  DE TECNOLOGIA E INFORMATICA PRIMARIACLASE  DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIAWilbisVega
 
trabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdftrabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdfIsabellaMontaomurill
 
Cortes-24-de-abril-Tungurahua-3 año 2024
Cortes-24-de-abril-Tungurahua-3 año 2024Cortes-24-de-abril-Tungurahua-3 año 2024
Cortes-24-de-abril-Tungurahua-3 año 2024GiovanniJavierHidalg
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveFagnerLisboa3
 
Hernandez_Hernandez_Practica web de la sesion 12.pptx
Hernandez_Hernandez_Practica web de la sesion 12.pptxHernandez_Hernandez_Practica web de la sesion 12.pptx
Hernandez_Hernandez_Practica web de la sesion 12.pptxJOSEMANUELHERNANDEZH11
 

Último (16)

Redes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfRedes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdf
 
La era de la educación digital y sus desafios
La era de la educación digital y sus desafiosLa era de la educación digital y sus desafios
La era de la educación digital y sus desafios
 
Proyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptxProyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptx
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Joseph
 
Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnología
 
Plan de aula informatica segundo periodo.docx
Plan de aula informatica segundo periodo.docxPlan de aula informatica segundo periodo.docx
Plan de aula informatica segundo periodo.docx
 
International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)
 
KELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento ProtégelesKELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento Protégeles
 
9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudiante9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudiante
 
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
 
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE  DE TECNOLOGIA E INFORMATICA PRIMARIACLASE  DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIA
 
trabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdftrabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdf
 
Cortes-24-de-abril-Tungurahua-3 año 2024
Cortes-24-de-abril-Tungurahua-3 año 2024Cortes-24-de-abril-Tungurahua-3 año 2024
Cortes-24-de-abril-Tungurahua-3 año 2024
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial Uninove
 
Hernandez_Hernandez_Practica web de la sesion 12.pptx
Hernandez_Hernandez_Practica web de la sesion 12.pptxHernandez_Hernandez_Practica web de la sesion 12.pptx
Hernandez_Hernandez_Practica web de la sesion 12.pptx
 

JUG DAY FLEX / JEE

  • 1. FLEX / JEE José Luis Coronel Cortes Arquitecto Tecnológico BEE Concretorías y Sistemas
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. Flex - BlazeDS Flash Player AIR Servidor JEE Flex BlazeDS Servicios WEB Servicios HTTP Objetos Remotos Servicio Mensajería Servicios WEB Servicios HTTP Objetos Remotos Servicio Mensajería
  • 7. Flex - BlazeDS web.xml MessageBroker Servlet services-config.xml messaging-config.xml proxy-config.xml remoting-config.xml Factoria
  • 8. Flex - BlazeDS BlazeDS Servicio Factoria Spring DAO Hibernate Ibatis
  • 9.
  • 10. Objetos Remotos Cliente Servidor remoting-config.xml Request ResultEvent RemoteObject Button DataGrid Handler ProductoServicio ProductoDAO
  • 11. Objetos Remotos Java public class ProductoServicio{ public Producto getProductoPorId(int productoId) throws Exception{ return productoDao.getProductoPorId(productoId); } public List getListadoProductos(){ return productoDao.getListadoProductos(); } } Servidor ProductoServicio ProductoDAO
  • 12. Objetos Remotos remoting-config.xml <destination id=“ productoServicio ”> <properties> <source> cl.jug.ProductoServicio </source> <scope> application </scope> </properties> </destination> Servidor ProductoServicio ProductoDAO remoting-config.xml
  • 13. Objetos Remotos MXML / ActionScript <mx:RemoteObject id=&quot; miServicio ” destination=“ productoServicio ” result=&quot; resultadoHandler(event) ” fault=“ errorHandler(event) &quot;/> import mx.rpc.remoting.RemoteObject; var miServicio : RemoteObject = new RemoteObject(); miServicio.destination = “productoServicio&quot;; miServicio.addEventListener(&quot;result&quot;, resultadoHandler); miServicio.addEventListener(&quot;fault&quot;, errorHandler); Cliente RemoteObject
  • 14. Objetos Remotos Button <mx:Button label=“ Listado Productos ” c lick=&quot; miServicio.getListadoProductos() &quot;/> <mx:Button label=“ Producto por Id ” click=“ miServicio. getProductoPorId (32) &quot;/> Cliente RemoteObject Button
  • 15. Objetos Remotos DataGrid <mx:DataGrid dataProvider=&quot;{ miServicio.getListadoProductos.lastResult }&quot;/>
  • 16. Objetos Remotos Handler [Bindable] private var productos : ArrayCollection; private function resultadoHandler(evento : ResultEvent) : void { productos = evento.result as ArrayCollection; }
  • 17. Objetos Remotos Métodos en el RemoteObject <mx:RemoteObject id=&quot; miServicio ” destination=“ productoServicio ” fault=&quot; faultHandler(event) “> <mx:method name=&quot; getListadoProductos ” result=“ listadoHandler(event) &quot;/> <mx:method name=&quot; getProductoPorID ” result=“ productoHandler(event) &quot;/> </mx:RemoteObject>
  • 18.
  • 19.
  • 20.
  • 21. Servicio de Mensajería Cliente Servidor Producer Consumer Button Handler messaging-config.xml
  • 22. Servicio de Mensajería Destination <destination id=“ clientes ”> <channels> <channel ref=“ my-polling-amf ”/> </channels> </destination> <destination id=“ destinoStream ”> <channels> <channel ref=“ my-streaming-amf ”/> </channels> </destination> Servidor Messaging-config.xml
  • 23. Servicio de Mensajería Producer <mx:Producer id=“ productor ” destination=“ clientes &quot;/> Cliente Producer
  • 24. Servicio de Mensajería Producer import mx.messaging.messages.AsyncMessage; var mensaje : AsyncMessage = new AsyncMessage(); mensaje.headers.user = “usuario”; mensaje.body = “Mensaje a enviar”; productor.send(mensaje); Cliente Producer Button
  • 25.
  • 26. Servicio de Mensajería Handler import mx.controls.Alert; private function mensajeHandler(evento : MessageEvent) : void { Alert.show(evento.message.body as String, “ Mensaje recibido desde el usuario : &quot; + evento.message.headers.user); } Cliente Producer Button Consumer Handler
  • 27. Servicio de Mensajería Subtopic Cliente 1 Cliente2 Componente A Componente B Componente A Componente B Servidor Topic Subtopic_A Subtopic_B
  • 28. Servicio de Mensajería Subtopic private function iniciarAplicacion() : void{ consumidor.subtopic = “chat.cliente1“; consumidor.subscribe(); } private function enviarMensaje(texto : String) : void{ var mensaje : IMessage = new AsyncMessage(); mensaje.headers = new Array(); mensaje.body.mensajeChat = texto; producidor.subtopic = &quot;chat.cliente1“; producidor.send(mensaje); }
  • 29. Servicio de Mensajería Subtopic – message-config.xml <destination id=&quot; chat “> <properties> <network> <session-timeout> 0 </session-timeout> </network> <server> <max-cache-size> 1000 </max-cache-size> <message-time-to-live> 0 </message-time-to-live> <durable> false </durable> <allow-subtopics> true </allow-subtopics> <subtopic-separator> . </subtopic-separator> </server> </properties> </destination>
  • 30. Servicio de Mensajería Selector private function iniciarAplicacion() : void{ consumidor.selector = &quot;propiedad1> 30“; consumidor.subscribe(); } private function enviarMensaje(valor : int, texto : String) : void{ var mensaje:IMessage = new AsyncMessage(); mensaje.headers = new Array(); mensaje.headers[&quot;propiedad1&quot;] = valor; mensaje.body.mensajeChat= texto; productor.send(mensaje); }
  • 31. Servicio de Mensajería Java - Header AsyncMessage mensaje = new AsyncMessage(); mensaje.setDestination(“chat&quot;); mensaje.setClientId(clienteId); mensaje.setMessageId(UUIDUtils.createUUID(false)); mensaje.setTimestamp(System.currentTimeMillis()); mensaje.setBody(“Hola Mundo!!”); Map map = new HashMap(); map.put(&quot;propiedad1&quot;, &quot;5&quot;); mensaje.setHeaders(map); mensajeBroker.routeMessageToService(mensaje, null);
  • 32. Servicio de Mensajería JMS – message-config.xml <destination id=“chat-topic-jms“> <properties> <server> <durable> false </durable> <durable-store-manager> flex.messaging.durability.FileStoreManager </durable-store-manager> </server> <jms> <destination-type> Topic </destination-type> <message-type> javax.jms.ObjectMessage </message-type> <connection-factory> jms/flex/TopicConnectionFactory </connection-factory> <destination-jndi-name> jms/topic/flex/FlexChatTopic </destination-jndi-name> <delivery-mode> NON_PERSISTENT </delivery-mode> <message-priority> DEFAULT_PRIORITY </message-priority> <acknowledge-mode> AUTO_ACKNOWLEDGE </acknowledge-mode> <transacted-sessions> false </transacted-sessions> </jms> </properties> <channels> <channel ref=&quot;my-polling-amf&quot;/> </channels> <adapter ref=&quot;jms&quot;/> </destination>