Jp, Thiago, thank you! Angelo
2013/6/26 Thiago Maia <[email protected]> > Hello > > I have Flex+Blazeds+Tomcat+Java in this application a00s.com > I using blazeds to send messages about whats going on at Java, when is > processing a lot of things, so I can send log message to customer before > the return happen from the java side. > Its just like a chat > > I'm using https but you can remove if is that your case > ------------------------------**---------------------------- > services-config.xml > > <channel-definition id="my-amf-poll" > class="mx.messaging.channels.**SecureAMFChannel"> > <endpoint > url="https://{server.name}:{**server.port}/{context.root}/** > messagebroker/amfpoll" > class="flex.messaging.**endpoints.SecureAMFEndpoint" /> > <properties> > <polling-enabled>true</**polling-enabled> > <polling-interval-seconds>1</**polling-interval-seconds> > <login-after-disconnect>false<**/login-after-disconnect> > <max-waiting-poll-requests>1</**max-waiting-poll-requests> > <client-wait-interval-millis>**1000</client-wait-interval-**millis> > <connect-timeout-seconds>1</**connect-timeout-seconds> > </properties> > </channel-definition> > ------------------------------**--------------------------- > messaging-config.xml > > <destination id="MessagingDestination" channels="my-amf-poll"> > <adapter ref="actionscript"/> > <properties> > <server> > <message-time-to-live>0</**message-time-to-live> > <allow-subtopics>true</allow-**subtopics> > <disallow-wildcard-subtopics>**true</disallow-wildcard-**subtopics> > </server> > </properties> > ------------------------------**----------------------------- > from actiong script you need to subscribe from customer, you may give a > unique id to each subscriber, when you send a message to this subtopic > everibody with this subtopic will receave > > anyactionscript.as > > try{ > consumer.subtopic ="any unique id"; > consumer.subscribe(); > } catch(e:Error){ > Alert.show(e.toString()); > } > ------------------------------**------------------------- > anyfile.mxml > > <fx:Declarations> > <mx:Consumer id="consumer" destination="**MessagingDestination" > message="MensagemRetorno(**event)"/> > </fx:Declarations> > ------------------------------**------------------------------**- > this is the return message > > public function MensagemRetorno(event:**MessageEvent):void > { > Alert.show("MessageEvent:"+**event.message.body,"debuga",**Alert.OK,this); > } > ------------------------------**------------------------------**- > This is how you send from Java, i usually register the customer with the > sessionid, so each one have one group, we can have the sessionid from this > command > mysession.getId() > > > > import flex.messaging.FlexContext; > import flex.messaging.FlexSession; > import flex.messaging.MessageBroker; > import flex.messaging.messages.**AsyncMessage; > > > AsyncMessage msg = new AsyncMessage(); > msg.setMessageId("myid"); > msg.setDestination("**MessagingDestination"); > msg.setBody(messageBody != null ? messageBody : ""); > FlexSession mysession; > mysession = (FlexSession)FlexContext.**getFlexSession(); > msg.setHeader("DSSubtopic", mysession.getId()); > MessageBroker.**getMessageBroker(null).**routeMessageToService(msg, null); > > ------------------------------**--------------------------- > I hope this help > > regards > > Thiago Benazzi Maia > [email protected] > > > Years ago there were tutorials on this with blazeds...not sure if your >> google-fu could find it (old stuff seems to disappear these days), but >> about 5 years ago I followed those steps and had a chat app. >> >> JP >> On Jun 25, 2013 3:44 PM, "Angelo Lazzari" <[email protected]> >> wrote: >> >> Hi all guys, i need your help again. >>> >>> I'm developing an app with apache flex and a java backend and graniteds. >>> >>> The app users should be able to chat with others app users. >>> >>> Now the question: create the chat architecture from scratch or use a chat >>> service like >>> http://quickblox.com/modules/**chat/<http://quickblox.com/modules/chat/> >>> ? >>> >>> Do you know others chat service? Did you create anything like this? >>> >>> Thank you again >>> Angelo >>> >>> > -- Angelo Lazzari mobile: 0039 347 0090 452 mail: [email protected] ---------------------------- Verificate la corrispondenza del destinatario; in caso contrario vogliate notificare ciò al mittente e, consci della responsabilita'per l'uso indebito, cancellare il messaggio e sue copie / Verify the correspondence of the addressee; otherwise, notify that to the sender and, conscious of the responsibility for the undue use, destroy the message and its copies. ----------------------------
