michaelpearce-gain edited a comment on issue #56:
URL: https://github.com/apache/activemq-nms-amqp/pull/56#issuecomment-617625748


   So actually the logic should be for non-persistent messages, you can always 
do async even if sync send, because for non persistent there is no guaranteed 
delivery.
   
   For persistent, on send sync, you need to block  for async you send async 
(Aka non block), but return task, and or return result on completion listener
   
   essentially we should change the NmsSession
   
   
   bool sync = connection.isForceSyncSend() ||
                              (!connection.isForceAsyncSend() && deliveryMode 
== DeliveryMode.PERSISTENT && !getTransacted());
   
   
   sync = deliveryMode == listener == null ? !sync : true
   
   
   Ill send make a change today there., then lower down in the stack, async 
send cannot be fireforget, it has to be asyncsend (return task and or handle 
callback)
   
   As well for transaction case, we will need to handle if completion is 
required, see logic in qpid around this.
   
   
   ```           if (envelope.isCompletionRequired()) {
                   transactionContext.send(connection, envelope, new 
ProviderSynchronization() {
   
                       @Override
                       public void onPendingSuccess() {
                           // Provider accepted the send request so new we 
place the marker in
                           // the queue so that it can be completed 
asynchronously.
                           asyncSendQueue.addLast(new SendCompletion(envelope, 
listener));
                       }
   
                       @Override
                       public void onPendingFailure(ProviderException cause) {
                           // Provider has rejected the send request so we will 
throw the
                           // exception that is to follow so no completion will 
be needed.
                       }
                   });
               } else {
                   transactionContext.send(connection, envelope, null);
               }
   ```
   
   
   As well some enhancement needed in transactionContext to handle inDoubt tx 
and also to  ensure async sends pass


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to