Uploaded image for project: 'FUSE Message Broker'
  1. FUSE Message Broker
  2. MB-460

MessageConsumer.receive() does not throw an exception if the connection to the broker is lost.


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Done
    • Affects Version/s:
    • Fix Version/s:,
    • Component/s: None
    • Labels:


      If you don't set an ExceptionListener on the connection to the broker from within your consumer you won't get any notification if the connection to the broker has been lost, instead MessageConsumer.receive() will only return null or block indefinitely depending on if you use the timeout parameter or not. The JMS specification clearly states (section 4.3.8):

      The exceptions delivered to ExceptionListener are those that have no other place
      to be reported. If an exception is thrown on a JMS call it, by definition, must
      not be delivered to an ExceptionListener (in other words, ExceptionListener is not
      for the purpose of monitoring all exceptions thrown by a connection).

      To reproduce this use my modified ConsumerTool.java, copy it into examples/src. Run the broker, then run the consumer like:

      ant consumer -Dtopic=false -Dmax=10

      Then run the producer like:

      ant producer -Dtopic=false -Dmax=5

      You'll see the consumer will get the 5 messages. Now Ctrl-C the broker and restart it. The consumer will still be running. If you run the producer again the consumer won't get the messages even though it's still blocked on MessageConsumer.receive().

      Also note that if I do use the ExceptionListener on the connection object but take out the timeout parameter on line 182 in ConsumerTool.java if an exception is handled by the ExceptionListener the call to receive() is still blocked which means the example consumer won't exit when you bounce the broker.

        Gliffy Diagrams




              • Assignee:
                dbosanac Dejan Bosanac
                stlewis Stan Lewis
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: