Why doesnt the class LocalTopic implements javax.jms.Topic, and why is the constructor packageprivate??
I want to do like this Topic topic = new LocalTopic(topicname); I know i can do it thru session: session.createTopic(....) but i should also be possible to do it separate.
This is working fine for Queues. LocalQueue looks like I expect.
Hi, it is designed this way intentionally. The LocalTopic class is an implementation detail, and as the platform grows to add new features, it may be necessary to change the way that this class is implemented. Using the factory method in the Session gives me the ability to change how Topics and Queues are represented internally without breaking existing code.
Also, using new LocalTopic() will create undesirable provider dependencies in your code. The JMS spec discourages this for a reason; so that you can easily plug and play different JMS implementations (or transport layers) without modifying working JMS code.
I agree on that you are creating provider dependencies, but if you are using TCP you still have to get the providerFactory so i cant really see the problem by using a provider spec. Queue/Topic.
I have written a Wrapper that hides JMS and let you 'plugin' different MQs. It supports SonicMQ, OpenJms, JORAM and JBossMQ and soon a few others included (hopefully) UberMQ.
All the others MQProviders provide a impl. of javax.jms.Topic/Queue so why not UberMQ?
The only thing i need to do to plugin a new MQprovider (TCP) is to implement:
public abstract javax.jms.QueueConnectionFactory getQueueConnectionFactory() throws JosConnectionException;
public abstract javax.jms.TopicConnectionFactory getTopicConnectionFactory() throws JosConnectionException;
public abstract javax.jms.Topic getTopic(JosDestination destination) throws JosDestinationException;
public abstract javax.jms.Queue getQueue(JosDestination destination) throws JosDestinationException;
Of course if you are using some kind of DS you could prob. use the wrapper directly :-)
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.