Configureing AIR app for blazeds messaging

View: New views
2 Messages — Rating Filter:   Alert me  

Configureing AIR app for blazeds messaging

by netdeep :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I am trying to get messaging working with my AIR application.  I'm converting a Flex application into AIR and everything works in Flex but not in AIR.  I can get remoting working, but messaging isn't working.  I set up remoting channels at runtime using the examples from this site:


http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId= 9703&productId=2
 

But I can't get it working for messaging.  How do I define destinations for AIR at runtime?  In Flex, I just define them in the messaging-config.xml file.  Here's what I have from the messaging-config.xml file which works in flex:
 
<?xml version="1.0" encoding="UTF-8"?>
<service id="message-service"
    class="flex.messaging.services.MessageService">
 
     <adapters>
        <adapter-definition id="TCautomation" class="factory.AutoWatcher"/>
        <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" />
    </adapters>
 
    <default-channels>
        <channel ref="my-polling-amf"/>
    </default-channels>
 
     <destination id="autoWatch">
         <adapter ref="TCautomation"/>
     </destination>
 
</service>

And here are my components in mxml:
 
<mx:Producer id="reportManager" destination="autoWatch"/>
<mx:Consumer id="consumer" destination="autoWatch" message="messageHandler(event.message)"/>

Pretty simple for Flex, but how is this done in AIR?


Re: Configureing AIR app for blazeds messaging

by wrhinfl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am interested in doing this too.  The book Adobe AIR Programming Unleashed has an example in chapter 13, I was finally able to get it to work.

The main thing it is stating near the begining of this example is "Under Additional Compiler Arguements, change the path inside the double quotes to match the install path of your BlazeDS server: {path to your BlazeDS folder}/tomcat/webapps/blazeds/WEB-INF/flex/services-config.xml"  But I generate my project saying it is AIR and will be using J2EE and lifecycle, clicked validate, and it is putting that information into the Additional Compiler Arguments for me (-services option).

Ok, long story short, here is what my Additional Compiler Arguments appears like in my project: -services "C:\Blazeds\tomcat\webapps\chat\WEB-INF\flex\services-config.xml" -locale en_US

The book told me to edit the messaging-config.xml file, but it seems that did not work.  Once I copied the service tag from the messaging-config.xml file into the services-config.xml file instead of using the "include file" tag.  And reboot BlazeDS it started working!  AIR application can send messages to my browser version and vice versa.  Also note that my services-config.xml does not have any reference to variables ( {server.name}, {server.port}, {context.root}, ...).

It is a really good example of a AIR chat program where it will even display a status that someone is typing.


--- In flexcoders@..., "netdeep" <deepnet@...> wrote:
>
>
> I am trying to get messaging working with my AIR application.  I'm converting a Flex application into AIR and everything works in Flex but not in AIR.  I can get remoting working, but messaging isn't working.  I set up remoting channels at runtime using the examples from this site:
>
>
> http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId= 9703&productId=2
>  
> ...