-1

I am working on an Azure Service Fabric project which reads a message from ActiveMQ using Apache.NMS .NET library and creating durable consumer to read message from specific from ActiveMQ.

I am able to read the message and everything is working fine, but I am getting some warning as following.

'System.RAP' reported Warning for property 'IStatelessServiceInstance.OpenDuration'. The api IStatelessServiceInstance.Open on node _Node_0 is stuck.

This warning results in erroring the service, so I need to remove that warning.

Anybody why it's giving me the warning.

Here is a snapshot of how I am reading the message.

try
{
    ITopic dest = AMQSession.GetTopic(TopicName);

    using (IMessageConsumer consumer = AMQSession.CreateDurableConsumer(dest, SubscriptionName, MessageSelector, false))
    {
        IMessage message;
        while ((message = consumer.Receive()) != null)
        {
            ITextMessage txtMsg = message as ITextMessage;            
        }
    }
}
catch (Exception ex)
{
    Close();
}
finally
{
    Close();
}
Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • You [already posted this *same* question](https://stackoverflow.com/questions/64278762/system-rap-reported-warning-for-property-istatelessserviceinstance-openduration) and it was closed due to lack of clarity. There is no added detail in this question. Can you add any details about your use-case, the service you're using/creating, when you see the error, etc.? Just posting the error message isn't really sufficient explanation. It needs more context. – Justin Bertram Oct 09 '20 at 14:43
  • @JustinBertram can you please look into this now – sueb mijaki Oct 09 '20 at 14:51
  • It's still not clear at what point you're receiving this warning message. Also, why do you believe this is related to consuming the JMS message? – Justin Bertram Oct 09 '20 at 15:08
  • What I think is it's related to TCP which listening to get Active MQ message. – sueb mijaki Oct 09 '20 at 15:21
  • Can you clarify *why* you think it's related to the ActiveMQ client? Also, you *still* haven't clarified at what point you're receiving this warning message. Is it when you start the consumer? Is it when the consumer has received a message and is waiting for another? Is it when the consumer closes? – Justin Bertram Oct 09 '20 at 16:09

1 Answers1

0

This problem is almost certainly caused by the fact that your code here can block forever. Specifically, consumer.Receive() will block forever if no message arrives. As the documentation states:

Waits until a message is available and returns it

Also, even if a message does arrive the while loop ensures that the containing method will never return.

I recommend you specify a timeout when attempting to consume messages. If the timeout elapses then Receive will return null and the loop will be broken and the code will no longer be blocked.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43