5 Replies Latest reply on May 21, 2009 12:08 PM by cpslo1999

    MDB external configuration

      I have a JavaEE system that has one feeder application and several consumer applications. The producer is transmitting messages over a JMS topic. The consumer applications are all EJB3 apps, and I had planned to use MDBs on the consumer systems to process the incoming messages. However, while most of the messages are legitimately broadcast messages, on occasion the producer system needs to target a specific consumer system. I had thought to do this via the selector mechanism. Something like this:

      clientID is NULL AND feed in ('feed1', 'feed2')
      OR
      clientID = 'myClientID' AND feed in ('feed1', 'feed2')


      I deploy my apps in ear files. Is there a way to specify a selector outside of the .ear file so the person installing the application can adjust the client ID? I'm hesitant to require that the person installing my consumer application(s) unzip the ear, change the selector's "myClientID" value, and rezip it. I would rather use a identical application package on our multiple production servers (and the test servers for that matter) and have other files, descriptors, or database settings outside of the ear tweaked to account for the environment.

      Ultimately, it would be great to be able to modify the selector at runtime so I can use my application's existing configuration mechanisms to locate and set the clientID. Is that possible?

      (FYI: I posted this scenario on the JB Messaging forum already to discuss the JMS aspects of this scenario http://www.jboss.org/index.html?module=bb&op=viewtopic&t=155644)

      Any other ideas are appreciated as well,

      Josh

        • 1. Re: MDB external configuration
          jaikiran

           

          I'm hesitant to require that the person installing my consumer application(s) unzip the ear, change the selector's "myClientID" value, and rezip it. I would rather use a identical application package on our multiple production servers (and the test servers for that matter) and have other files, descriptors, or database settings outside of the ear tweaked to account for the environment.

          I don't exactly remember which deployment descriptor file will contain the message selector - its either the ejb-jar.xml or the jboss.xml. In either case i guess you could specify some system property that gets substituted per system, dynamically. Something like this in the deployment descriptor:

          <message-selector>${someproperty}</message-selector>


          Then, you can pass this property value as a JVM parameter through the server startup scripts:

          run.bat -Dsomeproperty=myClientID


          You can edit the run.bat or run.conf to pass this property too.




          • 2. Re: MDB external configuration
            anilit99

            I remember setting message selector in jboss.xml. A neat solution I should say !

            • 3. Re: MDB external configuration

               

              "jaikiran" wrote:
              In either case i guess you could specify some system property that gets substituted per system, dynamically...

              Then, you can pass this property value as a JVM parameter through the server startup scripts...

              You can edit the run.bat or run.conf to pass this property too.


              That's a slick trick. Is property substitution on deployment descriptors a standard JavaEE thing, or is that specific to JBoss?

              • 4. Re: MDB external configuration
                anilit99

                I believe its a jboss specific thing.

                • 5. Re: MDB external configuration

                  Alright. I'll give it a go.

                  Thanks guys for the tip!