1 Reply Latest reply on Feb 18, 2002 4:05 AM by Peter Antman

    Questions on how to use JBossMQ

    Mack Newbie

      Hi,

      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

        • 1. Re: Questions on how to use JBossMQ
          Peter Antman Expert

          Hi, no your code will not work with JBossMQ. I am to not to happy about the way JBossMQ handles durable subs, but I am also aware of it beeing tricky to implement OK.

          The error you get when reconnecting is probably a bug in JBossMQ (if you did not try to create a new connection while the earlier one was still active, then you are doing wrong).

          What could be done then to get durable subscribers to work ok:

          Here are some of the problems:

          1. A durable subscription is allways the combination of a clientId, a destination and a subscription name.

          The crux is the clientId, since the spec says this: there must allways be a clientId for a durable subscriber, there must never be more than one active connection with the same clientId. ClientId are normally set adiminstratively. One is only allowed to set a clientId in the client if no one existed.


          This basically means, that to be able to create durable subs without administrative setup, the clientId should be void and would have to be set by the client.

          2. Then commes this problem: durable subsriptions take system resources and it should normally not be possible for clients to create these on a whim (that why clienId:s are normally set administrately.

          I currently does not know if JBossMQ uses the clientId in any other cituations that to manage durableSubscriptions.


          What I would like to have is something like this: create acl (administratively) for each destination. This could be based on rolse and could specify rwx, where x would mean that it is allowed to set its own clientId.

          This would however mean several rewritings of JBossMQ:

          a) The user/auth handling would need to be rewritten.
          b) A stable way of remebering dynamically created clientId and durable subscriptions would have to be implemented.

          Any one having other sugestions. Perhaps from how other JMS provider has solved this puzzle.

          //Peter