5 Replies Latest reply on Dec 29, 2001 9:59 PM by Hiram Chirino

    MDBs, Queues and JMX

    Anders Lindh Newbie


      Hi,

      I have a message-driven bean, which relies on an external component. Now I want to write a mbean that monitors this external component, and shuts down the JMS queue for the bean, if required.

      The problem is that even though I've stoped and/or destroyed the queue (either in the JMX management view, or programmatically) the message-driven bean still receives messages. What am I doing wrong?

      This is on happening on JBoss 2.4.3 / IBM VM.

      Thanks,

      - Anders

        • 1. Re: MDBs, Queues and JMX
          Hiram Chirino Expert

          We still have not implemented the fucntionality to allow stopping a queue (in the jbossmq server)

          Please post a patch if you are able to add this functionality.

          Regards,
          Hiram

          • 2. Re: MDBs, Queues and JMX
            Anders Lindh Newbie

            Damn, that's too bad.

            If I write an external client program for receiving the messages (instead of the MDB), I would get the wanted functionality just by stopping the client (i.e make if stop listening for messages). You're saying this behaviour can't be emulated with a MDB?

            Another solution would be to make the MDB more fault-tolerant, so that it would resend the message in case of a failure. This would however increase the load quite much if I have, say, a couple of hundred messages being received and resent all the time...

            - Anders

            • 3. Re: MDBs, Queues and JMX
              Hiram Chirino Expert

              I think if you undeploy the MDB, it should stop receiving messages.

              • 4. Re: MDBs, Queues and JMX
                Anders Lindh Newbie

                Yeah, but I wanna do it programmatically. Can that be done safely and reliably, and can the bean be re-deployed in the same fashion?

                But another thought crossed my mind. Could I write a mbean that uses the queue (instead of the MDB), so that it would drop/connect to the queue when notified by my monitoring mbean? This should be possible, and probably easier?

                - Anders

                • 5. Re: MDBs, Queues and JMX
                  Hiram Chirino Expert

                  Beans can be deployed and undeployed programaticaly (Actually I think it is encouraged, since the auto deployer can act flaky at times) via JMX.

                  And yes! you could develop a MBean that does the same thing that a MDB does (You would have to manage your own transactions and stuff tho.)

                  Regards,
                  Hiram