I have Tomcat talking to Flex using BlazeDS, but the conversation is one way. Flex has to initialize it.
I want to be able to publish to Flex from Java (in Tomcat). There are nice examples of the Flex code needed to catch this, and how to subscribe and all, but I cannot find any Java snippets that show how one initiates this conversation on that end.
Can anyone point me at some sample code for this?
Well, you are using Flex to talk to BlazeDS that is deployed on Tomcat. What version of BlazeDS are you using?
Can you elaborate more on "Flex has to initalize it"? You have a Flex client, so you need to register interest (subscribe) to messaging destination from Flex.
If you are asking:
Can you clarify what exactly you need? Hope that helps.
I am asking question #1. How do I push messages from a Java server to Flex.
I am using the most recent version of BlazeDS and a very recent version of Tomcat. BlazeDS was downloaded within the last couple of days. Tomcat is 6.0.29.
The link you posted is giving me a 404 Not Found error.
Consider for instance the example in Tour de Flex under Flex Data Access / Messaging Service / Basic Authentication - with Tomcat (NEW). It describes very nicely what to do on the Flex side, and what to do with the Tomcat configuration files. I just don't know what to do in the Java itself to cause the subscription to be invoked in Flex.
I'm guessing that this is a very simple question. It may be one of those that is so simple, people who already know how to do it are assuming that everyone else does, too.
With respect to subscribing from java, see how the consumer subscribe happens from flex (the source code for Consumer class is viewable in FB). You will have to basically emulate that in your java code. Roughly it means doing the following:
1. Authenticate your self, and ensure that user principal gets set on the FlexContext.
2. Create a Subscription Command message (with appropriate values like client id etc.) and pass to the MessageBroker.routeCommandToService(subscriptionCmd, null).