b_patil
b_patil

Reputation: 41

MQ XMS.NET Error while acknowledging a message

We're seeing a strange issue (not frequently) since last 2-4 weeks while acknowledging a message using message consumer.

It's throwing an error while acknowledging the message:

The method MQCMIT failed.

A IBM MQ call failed.

    StackTrace =    at IBM.XMS.Client.WMQ.WmqSession.Syncpoint(Boolean commit, Boolean fromOnMessage, String methodName)

   at IBM.XMS.Client.WMQ.WmqSession.Commit(Boolean fromOnMessage)

   at IBM.XMS.Client.Impl.XmsSessionImpl.CommitTransaction()

   at IBM.XMS.Client.Impl.XmsMessageImpl.Acknowledge()
                // Get an instance of factory.
                xmsFactoryIn = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
                // Create WMQ Connection Factory.
                connectionFactoryIn = xmsFactoryIn.CreateConnectionFactory();
                // Set the properties

                if (MQMode == (int)Location.Local)
                {
                    LogMessage($"CreateConsumerIn: MQ Location=Local ", Tracing.LogCategory.Debug, Tracing.LogLevel.DebugLow, null);

                }
                else if (MQMode == (int)Location.Remote)
                {
                    connectionFactoryIn.SetStringProperty(XMSC.WMQ_HOST_NAME, MQHostName);
                    connectionFactoryIn.SetIntProperty(XMSC.WMQ_PORT, MQPort);
                    connectionFactoryIn.SetStringProperty(XMSC.WMQ_CHANNEL, MQChannel);
                    LogMessage($"CreateConsumerIn: MQ Location=Remote. MQHostName = {MQHostName} MQPort = {MQPort} MQChannel = {MQChannel} ", Tracing.LogCategory.Debug, Tracing.LogLevel.DebugLow, null);
                }

                connectionFactoryIn.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
                connectionFactoryIn.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, MQManagerName);
                connectionFactoryIn.SetStringProperty(XMSC.WMQ_QUEUE_NAME, MQQueueNameIn);

                // In case of network issues - reconnect to same queue manager
                connectionFactoryIn.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_OPTIONS, XMSC.WMQ_CLIENT_RECONNECT_Q_MGR);
                connectionFactoryIn.SetStringProperty(XMSC.WMQ_CONNECTION_NAME_LIST, String.Format("{0}({1})", MQHostName, MQPort));
                connectionFactoryIn.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT, ReconnectInterval);
               
                // Create connection.
                connectionIn = connectionFactoryIn.CreateConnection();
                LogMessage($"CreateConsumerIn: MQ Connection created - {this.Name}", Tracing.LogCategory.Debug, Tracing.LogLevel.DebugMedium, null);
                connectionIn.ExceptionListener = new ExceptionListener(OnExceptionIn);
                // Create session
                sessionIn = connectionIn.CreateSession(false, AcknowledgeMode.ClientAcknowledge);
                LogMessage($"CreateConsumerIn: MQ Session created - {this.Name}", Tracing.LogCategory.Debug, Tracing.LogLevel.DebugMedium, null);

                // Create destination           
                destinationIn = sessionIn.CreateQueue(MQQueueNameIn);
                destinationIn.SetIntProperty(XMSC.WMQ_READ_AHEAD_ALLOWED, XMSC.WMQ_READ_AHEAD_ALLOWED_ENABLED);
                LogMessage($"CreateConsumerIn: MQ Destination created - {this.Name}", Tracing.LogCategory.Debug, Tracing.LogLevel.DebugMedium, null);

                // Create consumer
                messageConsumerIn = sessionIn.CreateConsumer(destinationIn);
                LogMessage($"CreateConsumerIn: MQ Consumer created - {this.Name}", Tracing.LogCategory.Debug, Tracing.LogLevel.DebugMedium, null);

                //Create message listener and assign it to the Message consumer
                messageListenerIn = new MessageListener(OnMessage);
                messageConsumerIn.MessageListener = messageListenerIn;
                connectionIn.Start();

Upvotes: 1

Views: 34

Answers (0)

Related Questions