protected virtual MessageAck CreateMessageAck(Message message)
 {
     MessageAck ack = new MessageAck();
     ack.AckType = (int) AckType.ConsumedAck;
     ack.ConsumerId = info.ConsumerId;
     ack.Destination = message.Destination;
     ack.FirstMessageId = message.MessageId;
     ack.LastMessageId = message.MessageId;
     ack.MessageCount = 1;
     
     if (session.Transacted)
     {
         session.DoStartTransaction();
         ack.TransactionId = session.TransactionContext.TransactionId;
         session.TransactionContext.AddSynchronization(new MessageConsumerSynchronization(this, message));
     }
     return ack;
 }
 public MessageConsumerSynchronization(MessageConsumer consumer, Message message)
 {
     this.message = message;
     this.consumer = consumer;
 }
 protected void DoAcknowledge(Message message)
 {
     MessageAck ack = CreateMessageAck(message);
     //Console.WriteLine("Sending Ack: " + ack);
     session.Connection.OneWay(ack);
 }