/// <inheritdoc /> public void Ack() { if (_messageQueueTransaction?.Status == MessageQueueTransactionStatus.Pending) { _messageQueueTransaction.Commit(); } }
public void Send(IMessage msg, MessageQueueTransactionType transactionType) { switch (transactionType) { case MessageQueueTransactionType.Single: using (IMessageQueueTransaction tx = provider.CreateMessageQueueTransaction()) { try { Send(msg, tx); tx.Commit(); } catch (Exception e) { tx.Abort(); throw new MonoMessagingException(e.Message, e); } } break; case MessageQueueTransactionType.None: Send(msg); break; case MessageQueueTransactionType.Automatic: throw new NotSupportedException("Automatic transaction types not supported"); } }
private ITransactionalMessage CreateTransactionalMessage(Stream stream, IMessageQueueTransaction messageQueueTransaction) { stream.Position = 0; using (var streamReader = new StreamReader(stream, Encoding.UTF8)) { var queueMessage = streamReader.ReadToEnd().DeserializeFromJson <QueueMessage>(); if (queueMessage != null) { Logger.Debug("Message received {QueueName} {Type} {%Message}", Name, queueMessage?.MessageType?.FullName, queueMessage?.MessageBody); } if (queueMessage == null) { messageQueueTransaction?.Commit(); messageQueueTransaction?.Dispose(); messageQueueTransaction = null; } return(new TransactionalMessage(queueMessage, messageQueueTransaction)); } }
public void Commit() { delegateTx.Commit(); }