I am using BlazeDS for data-push feature in my Flex application project. From the official tutorial, Getting started with BlazeDS, it shows messaging example with producer/consumer from API.
but how can I implement server side which doesn't need to be invoke from Flex client, but from within server-side instead. I got some idea but I don't know how to do because I'm a Flex developer, not Java developer, so I think you can help me.
In Google, there's a tutorial show about I need to extend
ServiceAdapter
class in Java-side, which extendsInvoke
method. Do I need to extend other class instead of this to do what I want?How to configure the
message-config.xml
to get the result like I describe above?
Do you need to push messages from the server to the client? In this case take a look in the BlazeDS samples. There is a sample in a folder called traderdesktop. The piece of code which is sending the messages is below:
Here is test code I wrote and use, at times, to test sending data to our client. It's a stripped down, bare bones Java example of a ServiceAdapter implementation. It removes a lot of unnecessary code from the existing examples on the web. It Compiles, works and I use it often in testing.
You need to set a few properties in tomcat to get this to work.
In
messaging-config.xml
, you need to add an adapter and destination:Add this line to the existing
<adapters>
tag:Add this destination to that same
messaging-config.xml
file:Finally, make sure the "my-streaming-amf" channel is defined in
services-config.xml
, as in:Note that in blazeDS, these two config files (messaging-config.xml and services-config.xml) are located in the following directory:
where
[nameOfYourApp]
is the directory your webapp lives in.I hope all that helps!
-kg
If you want to set the url to the stream at runtime do the following:
Just a heads up. This took some head banging to get going. I hope it helps someone.