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.

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Done
    • Affects Version/s: 5.3.0.0-fuse
    • Fix Version/s: 5.0.0.28-fuse, 5.1.0.3-fuse
    • Component/s: None
    • Labels:
      None
    • Similar Issues:
      Show 10 results 

      Description

      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.

        Activity

        Hide
        Dejan Bosanac
        added a comment -

        Fixed in trunk. Will be merged into 5.3.0.1 version.

        Show
        Dejan Bosanac
        added a comment - Fixed in trunk. Will be merged into 5.3.0.1 version.
        Hide
        Dejan Bosanac
        added a comment -

        Fix merged into 5.0 branch.

        Show
        Dejan Bosanac
        added a comment - Fix merged into 5.0 branch.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: