0
votes

I have a requirement where two systems (on different platforms) need to communicate with each other in realtime. We decided with Java Socket Connection between two applications. I will be building a Java Socket Server that receives a message (customer id) from a Java Client (which sits on another system) and the socket server returns customer loyalty ponts for that customer id. To get the loyalty points a jdbc connection will be required to a database. I want to know the following

  • The application server has Weblogic installed, can I deploy my java socket server in Weblogic?
  • The server is multi-threaded and creates a new thread for every new connection each time a new client makes a connection. I assume it will create a new JDBC connection for each new Thread. Is that right?
  • How will the connection pooling (both socket/jdbc) be managed?
1
Why not use a RESTful architecture?Luiggi Mendoza
The two systems we are connecting are AS400 Till controller and Oracle. This is going to be used in retail stores across the country thats why we need something that can work in realtime. With TCP socket connection, AS400 can send the card number/customer id to a host where oracle is installed using socket client and server socket then can retrieve the points using jdbc connection to Oracle and send it back to socket client. Hope it helps to understand why we are using TCP connection.Harshad

1 Answers

0
votes

You can expose server sockets via JCA in any Java EE server. Maybe you don't even need to implement it yourself: JCA Sockets

To a Java EE server a client can also connect via RMI to some EJB. But this usually involves the usage of application server specific libraries. So if your application has to run on different servers, this might not be an option.

The threading is handled for you - completely. Incoming calls (via JCA or RMI) usually use a worker thread (provided by the server).

The connection pooling is also handled for you. For your TCP server you don't need it, you only have one server socket and that's it. For JDBC connections one usually configures pools in the Java EE server and you would get a connection per transaction (not per thread, but connections are usually bound to transactions which are bound to a thread) when needed (that is some DataSource.getConnection() is being made [directly or by something else, e.g. JPA]).

And in addition to this: You can always use REST or SOAP to connect to your server.