java - Working around JMS MessageConsumer.receive(long) not returning within the timeout -
messageconsumer.receive(long)
allows specifying timeout on receive.
however, have found if make producer go away (e.g. killing process), receive on consumer doesn't always time out. in fact, waits forever , process never exits.
it turns out can add exceptionlistener
connection, has drawbacks: (1) might errors things other operation trying perform; (2) receive() still won't complete; (3) apparently used use exceptionlistener , causing other issues don't know specifics of.
one potential hack looks viable (we're using activemq) when stall occurs, thread in wait() (this implementation-specific seems common choice.) if got exception, interrupt thread doing receive() calls.
is sane solution? there more reliable, well-known, commonly-implemented workaround issue?
instead of using receive, setup message listener. seems bug in activemq, have reported issue in jira?
Comments
Post a Comment