cshannon commented on PR #1364:
URL: https://github.com/apache/activemq/pull/1364#issuecomment-2548368213

   > I just pushed a commit that uses a single-threaded Executor to perform the 
async send, and have that background thread wait until the current async send 
is finished. So application sender thread is not blocked (meet threading 
restriction) and async send is done one at a time. This will preserve ordering 
across the session "A session will only invoke one CompletionListener callback 
method at a time. For a given MessageProducer or JMSContext, callbacks (both 
onCompletion and onException) will be performed in the same order as the 
corresponding calls to the asynchronous send method."
   > 
   > TODO: Need to add a few more tests.
   
   I actually don't think this is the correct design. I think we _want_ to 
block the send call for now if we are just going to handle one at a time and 
essentially treat it like sync. As far as I know there is nothing that says the 
sender can't block and wait for the other thread to complete and it's much, 
much simpler. You could simply submit a task to execute the callback and wait 
for the future before continuing.
   
   Besides that, I don't see a benefit of the design to try and have a 
background thread that waits because:
   
   1. It very much increases complexity. I only briefly looked at the PR but 
the amount of extra handling involving count down lathes and things is going to 
make this very hard to not have a ton of bugs.
   2. You are not going to gain any performance. You have to wait for each 
message to process one at a time anyways if you are waiting for the callback 
handler.
   3. If you are not blocking the sending thread and you keep letting the 
sender send more messages how are you queueing that up and applying 
backpressure?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to