5 Replies Latest reply on Jan 8, 2003 7:04 AM by juhalindfors

    Correct way to configure an EJB (MDB)

    paulbandler

      I need to pass some configuration data to each MDB instance to tell it what to do with its messages - what is the 'best practise' way to achieve this? Should I have a ManagementBean to configure the MDB instances or use the container configuration mechanism, or have my own property file?

      All of these would see to have some potential and extending the container configuration seems best as it allow per instance configuration information. However most/all examples of its use seem to be for configuring aspects of an EJB's container rather than the EJB itself so I am unsure if it is appropriate to try to use it for my purpose - can anyone clarify if it is?

      thanks

        • 1. Re: Correct way to configure an EJB (MDB)

          MDB are stateless so having behavioral config per instance doesn't really make sense -- there's no way of knowing which instance handles which message as the container picks them from a pool as needed

          • 2. Re: Correct way to configure an EJB (MDB)
            paulbandler

            Thanks for the reply.

            Mmm, I hadn't really considered the impact of the fact that the container can create multiple instances of a particilar MDB - but that in itself doesn't negate what I'm trying to achieve - let me explain a little more about what I'm trying to achieve.

            I'd like to write a little MDB 'component' that will handle reliable forwarding of messages from one JMS server to another - i.e. mainly responsible for dealing with remote communication failures. I'd like to write this component once and then be able to use it (i.e. instantiate different Beans from it with different remote queue parameters) several times. So the fact that the container could instantiate several instances of the same bean with the same configuration parameters is okay, so long as I can still create several different MDB's from the same code.

            Assuming there's no problem in doing this, I think my question is still valid no?

            cheers,

            Paul

            • 3. Re: Correct way to configure an EJB (MDB)

              in that case deploy the same MDB more than once with different env-entries in your deployment descriptor

              • 4. Re: Correct way to configure an EJB (MDB)
                paulbandler

                Thanks - that's the mechanism that uses the importXml call-back to pickup the parameter right?

                • 5. Re: Correct way to configure an EJB (MDB)

                  the env entry will be imported to your bean's local namespace which you can then lookup and act upon