Uploaded image for project: 'ActiveMQ .Net'
  1. ActiveMQ .Net
  2. AMQNET-168

NPE with AutoAcknowledge mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.2.0
    • 1.2.0
    • MSMQ
    • None

    Description

      A'm using NMS.MSMQ for to produce messages to MSMQ
      If i create session with AcknowledgementMode.AutoAcknowledge it throws NullPointerException at Dispose Method

      Code

      ==================================================================

      using (var connection = connectionFactory.CreateConnection())
      {
      using (var session = connection.CreateSession(AcknowledgementMode.Transactional))
      {
      var destination = SessionUtil.GetDestination(session, mailQueue);

      using (IMessageProducer producer = session.CreateProducer())

      { producer.DeliveryMode = MsgDeliveryMode.Persistent; var request = session.CreateBytesMessage(Encoding.UTF8.GetBytes(serialized)); request.NMSType = "Test"; producer.Send(request, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.Zero); }

      } // throws exception
      }

      ==================================================================

      Problem is here

      ==================================================================

      public MessageQueueTransaction MessageQueueTransaction
      {
      get

      { //---------------------------------------------------------------------------------------- // messageQueueTransaction is null with AutoAcknowledge mode //---------------------------------------------------------------------------------------- if(messageQueueTransaction.Status != MessageQueueTransactionStatus.Pending) messageQueueTransaction.Begin(); return messageQueueTransaction; }

      set

      { messageQueueTransaction = value; }

      }

      ==================================================================

      Attachments

        Activity

          People

            jgomes Jim Gomes
            achmed Achmedzhanov Nail
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: