0 Replies Latest reply on Jul 25, 2007 4:34 AM by mskonda

    Issue with default clientId on ConnectionFactory

      I have setup a connectionfactory with a default client id as shown below:

      <?xml version="1.0" encoding="UTF-8"?>
       <server>
       <loader-repository>jboss.messaging:loader=ScopedLoaderRepository
       <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
       </loader-repository>
      
       <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
       name="jboss.messaging.connectionfactory:service=MyConnectionFactory"
       xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
       <constructor>
       <arg type="java.lang.String" value="my-client-id"/>
       </constructor>
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
       <depends>jboss.messaging:service=PostOffice</depends>
      
       <attribute name="JNDIBindings">
       <bindings>
       <binding>/MyConnectionFactory</binding>
       </bindings>
       </attribute>
       </mbean>
      </server>
      


      The connection factory is bound to 'MyConnectionFactory' as expected.

      In my test client, I am doing the normal JMS setup of fetching the CF and getting a connection.

      The issue is when I try to create a durable subscription with no client id (as I am assuming the connection obtained from CF will use the default client id set during CF creation) on the connection.

      Seems, that's not the case: I get
      java.lang.IllegalArgumentException: clientID name is null
      


      Here's my test case:
       public void testSimplestDurableSubscription()
       {
       try
       {
       logger.info("test started");
       Connection conn = cf.createConnection();
      
      
       // conn.setClientID("my-client-id");
      
       Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
       logger.info("Created session");
      
       /*
       * The client id and the subscriber id is same
       */
      
       s.createDurableSubscriber((Topic) TEST_DUR_TOPIC_DEST_1,"my-sub-id");
      
       logger.info("Created durable subscriber");
      
       ObjectName destObjectName = new ObjectName(
       "jboss.messaging.destination:service=Topic,name=" + getObjectName());
      
       List subs = listSubscriptions(destObjectName);
       logger.info("Number of subscriptions " + subs.size());
      
       assertNotNull(subs);
      
       // undeployDestination(TEST_DUR_TOPIC_1);
      
       closeConnection(conn);
       }
       catch (Exception ex)
       {
       logger.error(ex);
       }
       finally
       {
       try
       {
       undeployDestination(TEST_DUR_TOPIC_1);
       }
       catch (Exception e)
       {
       logger.error(e);
       }
       }
       }


      Any pointers where I'm going wrong?

      Thanks
      Madhu