|
Replies:
7
-
Last Post:
Sep 17, 2007 12:44 PM
by: bbergquist
|
|
|
|
|
|
|
create UDP server with glassfish/ejb
Posted:
Aug 29, 2007 3:41 PM
|
|
|
Hi, I have a mobile application that's using GPRS to send UDP messages to an IP address - wast amount of ~1K text messages every second. I want to create a UDP server app using the JAVA EE technology.After getting the messages over UDP, I would like to convert them to JMS messages and place them in a queue for message-driven beans to pick them up one by one. Now, I'm not sure if I can do this with Glassfish . Can I somehow open a UDP port and listen for messages ? Or should I rather make a Java SE app which receives messages from client and passes them into the application server message queue?
Thanks a lot !!
Ivan
|
|
|
|
|
|
|
Re: create UDP server with glassfish/ejb
Posted:
Aug 30, 2007 6:10 AM
in response to: cyvan
|
|
|
If you'd like to perform this inside GlassFish, I think you could do it with Lifecycle modules, which gets started and shutdown with glassfish and runs in its context, so you could send JMS messages. Or you could do just as you suggested, as a standalone program.
glassfish@javadesktop.org wrote: > Hi, > I have a mobile application that's using GPRS to send UDP messages to an IP address - wast amount of ~1K text messages every second. > I want to create a UDP server app using the JAVA EE technology.After getting the messages over UDP, I would like to convert them to JMS messages and place them in a queue for message-driven beans to pick them up one by one. > Now, I'm not sure if I can do this with Glassfish . > Can I somehow open a UDP port and listen for messages ? > Or should I rather make a Java SE app which receives messages from client and passes them into the application server message queue? > > Thanks a lot !! > > Ivan > [Message sent by forum member 'cyvan' (cyvan)] > > http://forums.java.net/jive/thread.jspa?messageID=233179 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net > For additional commands, e-mail: users-help@glassfish.dev.java.net > > >
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: users-help@glassfish.dev.java.net
|
|
|
|
|
|
|
|
Re: create UDP server with glassfish/ejb
Posted:
Aug 30, 2007 7:05 AM
in response to: cyvan
|
|
|
Have you considered building a connector following the connector architecture? That would allow you to build the solution entirely within the app server and avoid the separate stand-alone program. That could be a very good fit for your situation.
- Tim
|
|
|
|
|
|
|
|
Re: create UDP server with glassfish/ejb
Posted:
Aug 30, 2007 7:31 AM
in response to: tjquinn
|
|
|
glassfish@javadesktop.org wrote: > Have you considered building a connector following the connector architecture? That would allow you to build the solution entirely within the app server and avoid the separate stand-alone program. That could be a very good fit for your situation. >
...and for a cool NIO based UDP framework, you might want to look at [1] or [2]. I prefer [1] , but [2] is quite good as well 
-- Jeanfrancois
[1] http://grizzly.dev.java.net [2] http://mina.apache.org
> - Tim > [Message sent by forum member 'tjquinn' (tjquinn)] > > http://forums.java.net/jive/thread.jspa?messageID=233278 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net > For additional commands, e-mail: users-help@glassfish.dev.java.net >
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: users-help@glassfish.dev.java.net
|
|
|
|
|
|
|
|
Re: create UDP server with glassfish/ejb
Posted:
Aug 31, 2007 5:48 PM
in response to: tjquinn
|
|
|
OK, thank you all very much for your help.
Now, using j2ee connector architecture sounds cool, but I really have no idea how to use it in this case. I read several jca explanations, but I still can't figure out how I could use it.
Can you give me some hints ? Thanks a lot !
Ivan
|
|
|
|
|
|
|
|
|
|
Re: create UDP server with glassfish/ejb
Posted:
Sep 14, 2007 5:07 PM
in response to: sivakumart
|
|
|
Hi, thanks for the links.
I read a lot about JCA since my last post. I found that it shouldn't be so hard to implement an adapter for incoming messages in this case. I have some issues I couldn't sort out yet, though.
I want to make a resource adapter that opens a socket and listens for messages, than makes a Work object and passes it, with the fetched message, to the app server. When processed, the Work should pass the message to the JMS Queue. My problem is that I'm not sure how I can get a reference to the JMS Queue into the Work object. The Work is not executed in a container, so I cannot inject a Queue with annotation. I'd rather pass the message to the Queue than use resource adapter's createEndpoint method, and call the onMessage method directly. This way I can make use of app server's MDB pooling capabilities.
Thanks a lot,
Ivan
|
|
|
|
|
|
|
|
Re: create UDP server with glassfish/ejb
Posted:
Sep 17, 2007 12:44 PM
in response to: cyvan
|
|
|
You really cannot access the any JNDI resources inside of the connector directly. The JCA spec mentions that a connector has no JNDI context except in the calling thread of an outbound connection and in the MDB in an inbound connection.
I just did something similar. I created a JCA that has an inbound connector. I have a service that I started and run inside the connector using the WorkManager and Work items. I defined a listener interface and then wrote an MDB the implemented that interface. When I receive a UDP message, I pass the UDP data to the MDB endpoint. Inside the MDB implementation, you do have access to all of the J2EE facilities so inside here, you could post the a message to a JMS queue or topic. Inside the MDB, you can use annotations to get a hold of the JMS resource that you need (ie. connection factory, queue, etc.).
|
|
|
|
|