Azure / amqpnetlite

AMQP 1.0 .NET Library
Apache License 2.0
401 stars 143 forks source link

Remote did not respond to a drain request in time #488

Closed gorazspajzer closed 2 years ago

gorazspajzer commented 2 years ago

Hi!

I have situation when qpid client is connectiong to our broker and they initiate method "receive" they get this error after some time (20 or 30 seconds). When this java client is calling qpig method "receive" I get call to the method onCredit. declared: static readonly Action<int, Fields, object> onCredit = OnCredit;

So I can check if I have messages for this client and if so I will deliver them and in this situation everything is OK but if I don't have any messages then I don't do nothing and client is getting error: org.apache.qpid.jms.JmsOperationTimedOutException: Remote did not respond to a drain request in time at org.apache.qpid.jms.provider.exceptions.ProviderOperationTimedOutException.toJMSException(ProviderOperationTimedOutException.java:39) at org.apache.qpid.jms.provider.exceptions.ProviderOperationTimedOutException.toJMSException(ProviderOperationTimedOutException.java:25) at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:80) at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:112) at org.apache.qpid.jms.JmsConnection.pull(JmsConnection.java:915) at org.apache.qpid.jms.JmsConnection.pull(JmsConnection.java:899) at org.apache.qpid.jms.JmsMessageConsumer.performPullIfRequired(JmsMessageConsumer.java:732) at org.apache.qpid.jms.JmsMessageConsumer.dequeue(JmsMessageConsumer.java:332) at org.apache.qpid.jms.JmsMessageConsumer.receive(JmsMessageConsumer.java:213) at main.AMQPClient.receiveMessage(AMQPClient.java:242) at main.AMQPClient.run(AMQPClient.java:184)

So my question is what I can do here? Is it possible to signal client that i don't have any messages and that he tries latter? I tried to use link.SetCredit(0, true, true); (link is ListenerLink) but nothing changed.

Any idea?

Regards, Gorazd

xinchen10 commented 2 years ago

I added drain support to listener link. Please check the commit to see how it can be used.

gorazspajzer commented 2 years ago

You are unbelievable! Thank you!