tags:

views:

86

answers:

1

JMS API declare many General and concrete Interfaces (e.g., Connection vs. QueueConnection). It is documented that the best practice is to use the general interfaces (e.g. Session and not QueueSession). If my application is using both queues and topics and I'm going general, that is: Connection-->Session-->Topic/Queue, and suppose to support all JMS implementations (TiBCO, WebLogic, Websphere etc...) can I assume that using general entities will work for both types out-of-the-box (queues and topic)?

To emphasize my point: can I assume all implementers do implement the java.jms.Connection interface and can work in general matter for both types?

Thanks, Guy

+1  A: 

Hi, the java.jmx.Connection is not optional in JMS 1.1 specification so a valid implementation should work. Most of the optional stuff in JMS is listed in chapter 8 "JMS Application Server Facilities" of the JMS 1.1 spec.

One notable point is that ExceptionListener for a Connection is optional according to the spec.

I guess the main point here is that you really should review your design and implementation against the spec to make sure you are not relying on any optional features and you should be reasonably safe in having a portable implementation.

Petri Pellinen
Ok thanks, but if I choose to go with Connection thus Session (and not TopicSession) I can't create non-durable subscriptions. This implicate that I'll need to go back to TopicConnectionFactory, TopicConnection, TopicSession etc.... and in order to support queues as well I need to duplicate it to QueueConnectionFactory etc... Ant thoughts on this?
Guy
That is a valid point although wouldn't you still be able to session.unsubscribe() from a durable subscription to emulate a non-durable subscription?
Petri Pellinen
As far as I understand regarding durable subscriptions:1. You need to set a client ID to the connection2. You assume that the server was configured to support durable subscribersSince I can't assume anything regarding the server, the subscription may fail, thus I need the non-durable subscriptions.
Guy