8 Replies Latest reply on Apr 22, 2003 7:03 AM by paulbandler

    How to dynamicly change message selector?

    paulbandler

      I need to be able to programatally manage a Q (stop/start) it - that's fine. But I also need to be able to modify the message selector that MDB's use to retreive messages from the Q. Is there a way to achieve this?

      regards,

      Paul Bandler

        • 1. Re: How to dynamicly change message selector?

          The message selector is in the deployment
          descriptor.

          <message-driven>
          ...
          <message-selector>whatever</message-selector>
          ...
          </message-driven>

          Regards,
          Adrian

          • 2. Re: How to dynamicly change message selector?
            paulbandler

            > The message selector is in the deployment
            > descriptor.

            Yes, but can that be manipulated programatically while the MDB is running? If I modify the DeploymentDescriptor attribute of the org.jboss.management.j2ee.EJBModule MBean instance that represents the deployed MDB, will that information be propogated to the MDB and take effect in real-time?

            • 3. Re: How to dynamicly change message selector?
              paulbandler

              > The message selector is in the deployment
              > descriptor.

              Yes, but can that be manipulated programatically while the MDB is running? If I modify the DeploymentDescriptor attribute of the org.jboss.management.j2ee.EJBModule MBean instance that represents the deployed MDB, will that information be propogated to the MDB and take effect in real-time?

              • 4. Re: How to dynamicly change message selector?

                The deployment descriptor in MEJB is informational
                it has no affect on the EJB.

                The message selector is established when
                the MDB subscribes to Queue/Topic, i.e.
                at deployment.
                Actually, it is done by the JMSContainerInvoker,
                it might be possible to make the selector
                available through the MDB container jmx interface
                and force a restart of the invoker (similar to
                connection recovery processing).
                But that is a bit of a hack and would be jboss
                specific.

                In the case of Durable Topic subscriptions,
                if you change the selector,
                it effectively does an unsubscribe/subscribe
                so you will lose any previous messages in
                the subscription.

                Regards,
                Adrian

                • 5. Re: How to dynamicly change message selector?
                  paulbandler

                  Adrian,

                  > Actually, it is done by the JMSContainerInvoker,
                  > it might be possible to make the selector
                  > available through the MDB container jmx interface

                  I already have a locally 'enhanced' JMSContainerInvoker which adds a slightly more elaborate recovery / retry scheme so I am willing to do a further enhancement to this. However when I tried to find the JMX identity of the invoker I couldn't find it - it doesn't show up on the console and when I added 'getServiceName()' to its debug calls it printed 'null'.

                  Could you please clarify whether/how the invoker is JMX managable?

                  rgds,

                  Paul

                  • 6. Re: How to dynamicly change message selector?

                    The invokers aren't registered in the MBeanServer.
                    They are under the control of the relevent
                    container.
                    i.e. MessageDrivenContainer

                    Regards,
                    Adrian

                    • 7. Re: How to dynamicly change message selector?
                      paulbandler

                      > The invokers aren't registered in the MBeanServer.
                      > They are under the control of the relevent
                      > container.
                      > i.e. MessageDrivenContainer

                      Thanks for your patience Adrian....

                      ... but what is the MessageDrivenContainer MBean service name and how can I use it pass control/data down to the JMSContainerInvoker? In my test configuration I see an MBean instance called:

                      service=EjbModule,url=file%/C%/JBoss/jboss/server/default/deploy/ejb-Testrig1-rmpframework.jar

                      - is this what you mean by the container?

                      I see that the EjbModule contains a MessageDrivenContainer instance within its collection of Containers and I see that it is the MessageDrivenContainer that gets configured somehow with the ContainerInvoker. So are you suggesting that to get JMX control of the ContainerInvoker I would need to extend the EjbModule JMX interface with the operations I need and delegate them down to MessageDrivenContainer(s)?

                      Just taking a step back in case there is an easier solution - what I am trying to achieve is programatically enable/disable a particular MDB deployment and when it is enabled I need to tell it to only select messages that have a timestamp later than a particular time. The scenario is one where a 'backup' node is taking over from a failed primary node and needs to only pickup messages later than a particular time.

                      thanks,

                      Paul

                      • 8. Re: How to dynamicly change message selector?
                        paulbandler

                        Adrian,

                        Will a start/stop on the EjbModule MBean be safely and repeatably be delegated down to the startService/stopService entry points on the JMSContainerInvoker?

                        Tried to follow it thru' the source but got a bit lost where the EjbModule uses

                        serviceController.start(con.getJmxName());

                        to propagate the operation.

                        If I can use this start/stop and somehow put the timestamp I need to be inspected by the Invoker into a well-known JNDI accessable object perhaps I have the building blocks I need...

                        cheers,

                        Paul