You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jonathan Brown <jo...@hotmail.com> on 2013/01/24 17:25:59 UTC

Race condition due to asynchronous implementation of ActiveMQResourceAdapter.endpointActivation

I have a MessageDriven bean in jboss 7.  The ActiveMQResourceAdapter is
activated via the endpointActivation() method at the appropriate time
however due to the asynchronous nature of underlying
ActiveMQEndpointWorker.connect() implementation I run into a scenario in
which the resource adapter is 'activated' and execution flow continues but
the adapter itself is not yet capable of processing messages.   As a result
of this, some critical inter-process messages are not always received due to
the race condition between when I expect to be able to receive messages and
when the adapter is actually functional.

Questions:
1) Is the asynchronous behavior correct per the spec?  I took a quick look
and it wasn't entirely clear to me but this isn't my realm of expertise and
I need to do some more reading.  From the collective brain trust, what is
considered correct behavior?  Is the implication from endpointActivation()
running and exiting without any exceptions that the adapter should be
considered fully functional?  I would think so, but like I said, this isn't
something I've looked into deeply.  If that's the case, then perhaps a
WorkListener should be leveraged as part of the call to
workManager.scheduleWork() used in ActiveMQEndpointWorker.connect().

2) If the implementation is compliant with the spec and working as intended,
is there a way in my code that I can check the status of the adapter in
order to know if it's safe for me to continue or if I should pause for a
bit?  

tia,
jb




--
View this message in context: http://activemq.2283324.n4.nabble.com/Race-condition-due-to-asynchronous-implementation-of-ActiveMQResourceAdapter-endpointActivation-tp4662146.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.