5 Replies Latest reply on Sep 15, 2003 9:07 AM by Stephane Nicoll

    Block on Receive.

    garandi Newbie

      The receiver block and I don't get any out put.

      TextMessage msg =(TextMessage) qReceiver.receiv();

      Question: What should I do in order for the receiver not to block.

      This how my user-service.xml looks like.
      I can deploy without getting any exception.
      Thank you


        • 1. Re: Block on Receive.
          Stephane Nicoll Master

          >Question: What should I do in order for the receiver not to block.

          calling the receiveNoWait() method on your QueueReceiver.



          • 2. Re: Block on Receive.
            garandi Newbie

            Thank you Stephane, but when call receiveNoWait() I get a null pointer exception, which tells me that it did not received the msg.
            I guess my user-service.xml has problem, although when I start jboss it DOES NOT complains.

            QueueSenderExample.java and QueueReceiverExample.java are both in a package called examples. and the path is c:\example.QueueSenderExample.java and same is for QueueReceiverExample.java and this is how first part of my user-serive.xml file looks like.

            It is almost 3 days that I am trying to run a JMS example but I fail, so any help will be appreciated.
            Thannk you in advance.

            • 3. Re: Block on Receive.
              Stephane Nicoll Master


              When using a method/API you don't know you better read the Javadoc first ;-)

              receiveNoWait() will not block. If a message is available, it will be retrurned to you. If no message is matching your criterias( that is the queue, a selector if any, etc ...) 'null' is returned.

              The nullpointerexception you get is simply because you forgot to test wether the method returns you a message or not.

              Now, if you are sure you have a message in this queue this might be the problem. Do you know the jmx-console? It allows you to manage your Jboss instance, see http://yourhost:8080/jmx-console

              You'll see namely the jboss.mq.destinations domain cotaininsg all your declared queue.

              you user service has definitely a problem. Why do you define a QueueManager? What version of JBoss are you running? Yo decalre a queue Named QueueReceiverExample (is it the purpose), put that definition in a xxxx-service.xml (where xxxx can be user but it's not mandatory)

              <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager



              • 4. Re: Block on Receive.
                Stephane Nicoll Master

                One more thing. Do not mix client/server components. If your QueueReceiverExample is a regular, stand alone java application, it' could be anytwhere, provided you have the jbossall-client.jar in your classpath (that one is in $JBOSS_HOME/client)

                Please provide more details about what you are trying to achieve.



                • 5. Re: Block on Receive.
                  Stephane Nicoll Master

                  Uh uh you're the same guy. So you should already have this code snippet ... Let's summarize your problem in one thread, will you?