views:

111

answers:

4

I need to develop a system which accepts orders and returns confirmation. Orders could come from java or non java clients.

Not sure whether to go for web service implementation or JMS.

Any suggestions ...

A: 

For interoperability sake, use a web service. JMS is little used outside the Java world.

Sjoerd
Also the I always thought the idea behind JMS was the ability to queue messages where as a Web Service is like an API call and direct. I would also suggest you Consider REST as an implementation
Scott Warren
JMS, by definition, is *only* used in the Java world, because it's just an API. It's perfectly capable of talking to non-java systems, though, that's the whole point.
skaffman
A: 

check the links

difference between using JMS/Messaging Middleware versus Web services

Messaging, JMS and Web Services

Web Services HTTP vs. JMS

Choosing among JCA, JMS, and Web services

Java Message Service

Web service

So if communicating Applications are Java based use JMS and if may be different then Web services... thats what which I follow.

Azhar
+3  A: 

JMS is an API which abstracts messaging middleware, like ActiveMQ or IBM MQSeries.

Messaging middleware has a store-and-forward paradigm and asynchronous message passing, while web services tend to promote a synchronous procedure calling paradigm. In distributed systems where a lot can go wrong, dealing with things asynchronously tend to focus the mind better to the things you need to do when part of the system is not available or poorly performing and the code needed to deal with that tends to be a lot less complicated.

Clustering parts become trivial if you have multiple servers listening on the same queue, parallelism and load balancing is for free in this case.

Personally I find JMS much easier to work with and more robust and reliable than web services, but the messaging middleware must support all platforms you want to use. If all the components who need to talk to each other are under your control, I would give a messaging middleware with a JMS interface serious consideration.

If the other party is external then probably Web Services rule, and in that case you could think of a using thin layer to convert the external web service to an internal message passing infrastructure so you still have the most of the advantages.

If it is "just slapping an remote API on a webapp" then of course it does not pay either to setup asynch messaging.

Peter Tillemans
+2  A: 

You can use both depending on your interoperability, scale, distribution and integration requirements.

Web service approaches utilising SOAP, XML RPC and REST provide something quite interoperable given the use of HTTP as the protocol. From a service side, you might receive a web service request and then marshal it into a message. Your message could then be delivered to a messaging bus.

JMS is a reasonable API for interfacing with a messaging bus and I've found that Active/MQ very good here. Active/MQ supports JMS across many languages.

With messaging you can utilise the Request/Reply Enterprise Integration Pattern to receive responses and return them via your web service. However think about the merit of providing immediate feedback as to whether the order has been processed vs feeding back the fact that an order has been received; you might not need to implement request/reply to acknowledge that an order has been received.

The benefits of messaging can be found here: http://www.eaipatterns.com/Messaging.html

You may even want to look at Apache Camel to simplify the development of highly scalable and distributed service layers.

Christopher Hunt