Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I react to my device from a J2EE architecture

Status
Not open for further replies.

danpersson

Programmer
Jul 5, 2006
3
US
I'm a Java dekstop programmer, but I've recently been working on a J2EE project.

I have a remote device that comes online periodically and initiates a tcp connection with my server.

I'm looking for the right component to use to react to this. Once the connection is established, my server needs to poll the device for information (multiple transactions) and then store the information in a database.

The polling is done in a proprietary protocol.

EJB seems to be the natural answer, but everything I've read has indicated that they are limited to one transaction with the remote device.

 
The EJB2.1 Specification forbids you from using TCP connections from within EJBs if I remember correctly.

Don't know if this has been relaxed in later EJB models.

You can do TCP quite easily using java.net.* classes from J2SE. Since the protocol is proprietary, this is the way I'd go.

Tim
 
Thanks Tim,

Would I have any scalability issues if I did this in J2SE on the server. I guess I would spawn a thread every time a connection was established.

Once I've got my information is there an easy way inside of J2SE to pass of that information to my EJBs that store in my database?

Dan
 
What about a pure J2SE sollution?

A server socket in the server and a JDBC connection to update the database. Sounds to me like device management has little to do with J2EE.

Cheers,
Dian
 
If you've already got a EJB layer on top of your database, there's no reason why your J2SE Server Socket app can't behave as a EJB Remote client to store the data.

If you don't already have an EJB layer, I'd think carefully before using one. Keeping away from EJB is probably better unless you've got a good readon for using it. Do like Dian suggests and use a pure J2SE solution.

Tim
 
Thank you both very much. I will stick to J2SE entirely. I think I had it in my head that I needed to use J2EE because it will run on a server.

Thanks,
-Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top