Question

I'm developing a website using Spring and Hibernate. This website is something like a dashboard to control the status of tasks sent to remote workers whom have to process them and return a result.

What I need is to send a JSON from the website app with all the info needed to compute the task to an idle worker (status information is actually in the DB) and periodically get the workers statuses in a JSON format. Actually I'm using ObjectMapper to generate the JSONs.

As long as I'm sending some credentials as part of tasks info, I need to establish a secure connection between the website and the workers so my first idea was to use SSLSockets (being workers the servers) but I'm not sure if is a good idea to do this under Spring nor if this framework have a mechanism to do it in a better way. I've been reading also about URLConnection but doesn't seem to be a good approach because I won't have an url where to post results.

What would be, in your opinion, the best way to communicate the website and the workers to send and receive JSONs?

Was it helpful?

Solution

You could use Spring Integration to send a pull the json messages using a tcp channel

See http://static.springsource.org/spring-integration/docs/latest-ga/reference/html/ip.html

and see http://static.springsource.org/spring-integration/docs/latest-ga/reference/html/ip.html#ssl-tls for SSL support.

Other good option (and well integrated with Spring) is Apache Mina.

Note that usually, for java to java RPC, is easy to use RmiInvokers or HttpInvorkes. Both serialize java classes avoiding text-to-object transforms.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top