Questions on how to use JBossMQ
mack_ng Feb 18, 2002 1:43 AMHi,
I have been using JMS for my projects since 2000. Recently, I need to use JMS again for a messaging system. I have been evaluating a few JMS Implementations, and found out that not all providers support the exact JMS Specs. Most of the incompatibilities surrounding the durable subscribers and JMSXGroupID (for message acknowledging purpose). For example, when I use OpenSourceJMS and Tibco, my program works well. But when I switched to iPlanet JMQ, there was an error on durable subscriber unique ID. When I used SonicMQ, there was an error in JMSXGroupID.
Now, I have come to evaluate JBossMQ, and I encountered some difficulties:
1. My program needs to have dynamic instatiantion of durable subscriber, by using the methods:
topicConnection = topicConnectionFactory.createTopicConnection();
topicSession = topicConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
topicSubscriber = topicSession.createDurableSubscriber(topic, /*durable subscriber name */, true);
This method works well for OpenSourceJMS and Tibco. However, after reading the examples in the JBoss Forum, I found out that for every durable subscriber instantiated, before that, I need to do some settings in jbossmq-state.xml (User and password). My question is whether I really need to do that before I set the durable subscriber and if not, please guide me on the workaround on this problem.
2. I tried to use the following methods to establish durable subscriptions, based on the user properties set in the jbossmq-state.xml:
topicConnection = topicConnectionFactory.createTopicConnection(username in the jbossmq-state, password in jbossmg-state.xml);
topicSession = topicConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
topicSubscriber = topicSession.createDurableSubscriber(topic, /*durable subscriber name */, true);
When I use topicSubscriber.close() to close the susbscription, and tried to re-establish subscription, I got an exception:
Cannot get a client ID: Cannot get a client ID
************* Start Tracing *************
org.jboss.mq.SpyJMSException: Cannot get a client ID
at org.jboss.mq.Connection.askForAnID(Connection.java:488)
at org.jboss.mq.Connection.(Connection.java:118)
at org.jboss.mq.SpyConnection.(SpyConnection.java:47)
at org.jboss.mq.SpyConnectionFactory.createTopicConnection(SpyConnectionFactory.java:76)
at newspage.commserver.comm.OutgoingMsgHandler.connectToTopic(OutgoingMsgHandler.java:89)
at newspage.commserver.comm.OutgoingMsgHandler.connectionAccepted(OutgoingMsgHandler.java:469)
at newspage.commserver.comm.IncomingMsgHandler.handlePacket(IncomingMsgHandler.java:262)
at newspage.commserver.comm.IncomingMsgHandler.run(IncomingMsgHandler.java:561)
linked exception is:
javax.jms.JMSSecurityException: The login id has an assigned client id. That client id is already connected to the server!
<<no stack trace available>>
What is wrong?
3. When I tried to set the property JMSXGroupID, I got the exception:
Bad property name: Bad property name
************* Start Tracing *************
javax.jms.JMSException: Bad property name
at org.jboss.mq.SpyMessage.CheckPropertyName(SpyMessage.java:351)
at org.jboss.mq.SpyMessage.setStringProperty(SpyMessage.java:415)
at newspage.commserver.comm.handler.PayloadHandler.publishAndSendAck(PayloadHandler.java:195)
at newspage.commserver.comm.handler.PayloadHandler.process(PayloadHandler.java:161)
at newspage.commserver.comm.IncomingMsgHandler.handlePacket(IncomingMsgHandler.java:384)
at newspage.commserver.comm.IncomingMsgHandler.run(IncomingMsgHandler.java:561)
************* End Tracing *************
I hope that someone who has used JBossMQ before to give me some guidances on the above issues. I think that my program is in strict accordance to JMS specs (and in fact, it works well for openSourceJMS and Tibco). Anyway, if anyone of you have found that I misunderstand JMS Specs, please feel free to advise me.
Thanks,
Mack