sam liya wrote:I need to know whether JMS can send only asynchronous messages or it can send synchronous?
The JMS API doesn't directly support request/response messaging, but you could build this in your application on top of what JMS provides, by having the two endpoints act as both producers and consumers. Endpoint-1 (client) would send a request message to endpoint-2 (server), and then endpoint-1 would block waiting for a response message from endpoint-2. After processing the request, endpoint-2 would then send a response message to endpoint-1.
In the request message sent by endpoint-1, an identifier value could be set carried in the JMSCorrelationID header. Endpoint-2 would extract the identifier from the received message and set the JMSCorrelationID in its response message to the same value. Endpoint-1 would use the identifier value to build a message selector so only messages which match the selector expression would be delivered to it. You may want to use to use a pair of message queues - one for request messages and another for response messages.