2 Replies Latest reply on Dec 29, 2006 10:12 AM by Mike Osganian

    How do you enable JMSXUserID message property

    Mike Osganian Newbie

      I'm using JBoss 4.0.4.

      The JMS spec says that the message driven bean can get the username of the user that dropped the message on the queue by getting the message property value 'JMSXUserID". I am doing the following in my client:

      System.setProperty(Context.SECURITY_AUTHENTICATION, "simple");
      System.setProperty(Context.SECURITY_PRINCIPAL, "test");
      System.setProperty(Context.SECURITY_CREDENTIALS, "test");
      Hashtable ht = new Hashtable(System.getProperties());
      ConnectionFactory cf = (new InitialContext(ht)).lookup(JNDI_FACTORY_NAME);
      ...
      producer.send(message);
      ...
      


      In my MDB:

      String username = message.getStringProperty("JMSXUserID");
      


      What am i missing?

      Thanks!
      Mike


        • 1. Re: How do you enable JMSXUserID message property
          Mike Osganian Newbie

          So it looks like JBoss 4.0.4 doesn't support the optional JMSX property JMSXUserID. So is there a way to know on the MDB side what user id sent the message? It's not an authentication thing since the user was already authenticated in order to connect to the queue and publish a message to it. Its about know who sent the message so I can perform business logic queries and such.

          Weblogic supports this by setting a boolean property on its connection factory.

          Anybody know how to do this in JBoss? Of course I can't simply say the client must set a message property because that would be cheating (i.e., user is named 'test' and he decides to set the special username message property to 'root'). The provider during the message send operation will have to do it.

          Thanks for any help.
          Mike

          • 2. Re: How do you enable JMSXUserID message property
            Mike Osganian Newbie

            I also tried calling MessageDrivenContext.getCallerPrincipal() but that always returns 'anonymous'. I'm creating a connection to the factory like:

            Connection sendConnection =
             connectionFactory.createConnection("dude", "test");
            


            Any help would be appreciated.
            Mike