You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Gordon Sim <gs...@redhat.com> on 2018/07/02 10:05:26 UTC

Re: how AMQP connection can be active upto lifetime of application

On 30/06/18 14:43, Abhishek Kumar wrote:
> HI Team,
> 
> 
> 
> I am using "qpid-jms-client-0.34.0" for connecting to servicebus.
> 
> 
> 
> I am getting error "*The connection was inactive for more than the allowed
> 60000 milliseconds and is closed by container*".
> 
> 
> 
> I even setted as "amqp.idleTimeout=-1" but it is not working and throwing
> error every 60 second. Please find below complete connection URL.

The idle timeout value is used to inform the server how often then 
client wants it to send traffic or heartbeats in order to prevent the 
client considering it a dead connection.

Altering or adjusting the corresponding value as set by the server is 
something you would need to do through some servicebus control 
interface, assuming that is allowed.

However, my suspicion would be that the error you are getting is not 
related to the heartbeating, but is perhaps some higher level 
restriction. I would contact servicebus support to ask them about it and 
whether it is configurable. Probably also write your application to be 
able to reconnect to handle that case.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: how AMQP connection can be active upto lifetime of application

Posted by Gordon Sim <gs...@redhat.com>.
On 04/07/18 17:21, akabhishek1 wrote:
> *OPTION* - So i have only option to handle this situation. Whenever i got
> this type of exception, then create New Connection, New Session and New
> Producer. This is not a good idea but i don't have any other option.

That sounds like a reasonable solution to me.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: how AMQP connection can be active upto lifetime of application

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie And Gordon,

Thank you so much for your valuable information.  

We can not create producer with null destination or invalid destination, it
throws error. 

So for fixing this issue, i created temporary producer with valid
Destination. After creating "temporary producer" this problem solves and
started getting different error in 15 minute. 

*Error Is *- "The connection was inactive for more than the allowed 300000
milliseconds and is closed by container 'LinkTracker'.
TrackingId:#####21f77a_G6, SystemTracker:gateway7, Timestamp:7/4/2018
3:47:12 PM [condition = amqp:connection:forced]"

*For Fixing this issue* - I tried to create New Session and New Producer
from existing Connection, BUT i am not able to create new session and
producer with *existing Connection object*. 

*OPTION* - So i have only option to handle this situation. Whenever i got
this type of exception, then create New Connection, New Session and New
Producer. This is not a good idea but i don't have any other option. 

I understand that there is no issue from QPid JMS Client. *Could you please
suggest is there any other option to handling this scenario?*

I am afraid to create consumer for dummy queue because there are lot of
application depends on this common component. They might be afraid for
creating dummy queue. 

Please suggest your opinion, i will further from your opinion. 

Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: how AMQP connection can be active upto lifetime of application

Posted by Gordon Sim <gs...@redhat.com>.
On 02/07/18 13:02, Robbie Gemmell wrote:
> On 2 July 2018 at 12:47, Gordon Sim <gs...@redhat.com> wrote:
>> On 02/07/18 12:33, akabhishek1 wrote:
>>> Conclusion - It seems, we definitely need to have one active
>>> producer/consumer
>>>
>>> Requirement - Need to create producer on demand.
>>
>>>
>>>
>>> Could you please suggest best approach to handle this scenario.
>>
>>
>> I don't understand your question. Presumably you know what you want to be
>> sending or receiving or there is no need to be connected. If the issue is
>> that you may send to different addresses you can pass null for the
>> destination when creating the producer then set the destination per-message.
>> (Not sure if that has any impact on the idle policy for servicebus as you
>> describe above).
>>
> 
> I dont think ServiceBus advertises support for ANONYMOUS-RELAY, so the
> JMS client wont use an an anonymous terminus link, and will fall back
> to opening and closing links for messages sent with the producer
> object in that case, which wouldnt give the desired effect I think you
> had in mind.

Ah, ok, sorry for misinformation then! One simple option would be to 
create some sort of 'dummy' or 'control' address and have the client 
always subscribe to that.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: how AMQP connection can be active upto lifetime of application

Posted by Robbie Gemmell <ro...@gmail.com>.
On 2 July 2018 at 12:47, Gordon Sim <gs...@redhat.com> wrote:
> On 02/07/18 12:33, akabhishek1 wrote:
>>
>> Hi Gordon And Robbie,
>>
>> Thanks a lot for your response. I think you are right it seems upper level
>> exception.
>> After doing research, i came on below conclusion.
>>
>> Problem - If we create only Connection(without producer and consumer) and
>> kept Connection idle without creating producer and consumer, then we are
>> receiving "idle timeOut" error.
>> Workaround - If we create Connection with producer/consumer and kept idle
>> without doing anything, then we are not receiving any error.
>
>
> That makes sense, since without either a producer or a consumer, you can't
> do anything. What is the point of being connected if you are not going to
> either send or receive messages?
>
>> Conclusion - It seems, we definitely need to have one active
>> producer/consumer
>>
>> Requirement - Need to create producer on demand.
>
>>
>>
>> Could you please suggest best approach to handle this scenario.
>
>
> I don't understand your question. Presumably you know what you want to be
> sending or receiving or there is no need to be connected. If the issue is
> that you may send to different addresses you can pass null for the
> destination when creating the producer then set the destination per-message.
> (Not sure if that has any impact on the idle policy for servicebus as you
> describe above).
>

I dont think ServiceBus advertises support for ANONYMOUS-RELAY, so the
JMS client wont use an an anonymous terminus link, and will fall back
to opening and closing links for messages sent with the producer
object in that case, which wouldnt give the desired effect I think you
had in mind.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: how AMQP connection can be active upto lifetime of application

Posted by Gordon Sim <gs...@redhat.com>.
On 02/07/18 12:33, akabhishek1 wrote:
> Hi Gordon And Robbie,
> 
> Thanks a lot for your response. I think you are right it seems upper level
> exception.
> After doing research, i came on below conclusion.
> 
> Problem - If we create only Connection(without producer and consumer) and
> kept Connection idle without creating producer and consumer, then we are
> receiving "idle timeOut" error.
> Workaround - If we create Connection with producer/consumer and kept idle
> without doing anything, then we are not receiving any error.

That makes sense, since without either a producer or a consumer, you 
can't do anything. What is the point of being connected if you are not 
going to either send or receive messages?

> Conclusion - It seems, we definitely need to have one active
> producer/consumer
>
> Requirement - Need to create producer on demand.
 >
> Could you please suggest best approach to handle this scenario.

I don't understand your question. Presumably you know what you want to 
be sending or receiving or there is no need to be connected. If the 
issue is that you may send to different addresses you can pass null for 
the destination when creating the producer then set the destination 
per-message. (Not sure if that has any impact on the idle policy for 
servicebus as you describe above).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: how AMQP connection can be active upto lifetime of application

Posted by akabhishek1 <ma...@gmail.com>.
Hi Gordon And Robbie,

Thanks a lot for your response. I think you are right it seems upper level
exception. 
After doing research, i came on below conclusion. 

Problem - If we create only Connection(without producer and consumer) and
kept Connection idle without creating producer and consumer, then we are
receiving "idle timeOut" error. 
Workaround - If we create Connection with producer/consumer and kept idle
without doing anything, then we are not receiving any error. 
Conclusion - It seems, we definitely need to have one active
producer/consumer 

Requirement - Need to create producer on demand.

Could you please suggest best approach to handle this scenario.

Please find below code snippet and attached example
(TestQpidSendIdleTimeout.java).

//CODE

	Connection connection = connectionFactory.createConnection(USERNAME,
PASSWORD);
	connection.setExceptionListener(this); // Settted ExceptionListener
	connection.start();
	
	//*********** WORK_AROUND ***********//
	//if we create producer, then we will not get inactive connection timeOut
error. 
	//it seems we should definitely have one producer/consumer otherwise we
will get
	//connection timeOut error
	
	/*Session session = connection.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
	Destination destination = session.createQueue(QUEUE_NAME);
	MessageProducer messageProducer = session.createProducer(destination);*/

Regards,
Abhishek Kumar

TestQpidSendIdleTimeout.java
<http://qpid.2158936.n2.nabble.com/file/t396358/TestQpidSendIdleTimeout.java>  



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: how AMQP connection can be active upto lifetime of application

Posted by Robbie Gemmell <ro...@gmail.com>.
On 2 July 2018 at 11:05, Gordon Sim <gs...@redhat.com> wrote:
> On 30/06/18 14:43, Abhishek Kumar wrote:
>>
>> HI Team,
>>
>>
>>
>> I am using "qpid-jms-client-0.34.0" for connecting to servicebus.
>>
>>
>>
>> I am getting error "*The connection was inactive for more than the allowed
>> 60000 milliseconds and is closed by container*".
>>
>>
>>
>> I even setted as "amqp.idleTimeout=-1" but it is not working and throwing
>> error every 60 second. Please find below complete connection URL.
>
>
> The idle timeout value is used to inform the server how often then client
> wants it to send traffic or heartbeats in order to prevent the client
> considering it a dead connection.
>
> Altering or adjusting the corresponding value as set by the server is
> something you would need to do through some servicebus control interface,
> assuming that is allowed.
>
> However, my suspicion would be that the error you are getting is not related
> to the heartbeating, but is perhaps some higher level restriction. I would
> contact servicebus support to ask them about it and whether it is
> configurable. Probably also write your application to be able to reconnect
> to handle that case.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

As Gordon noted, the client side amqp.idleTimeout URI config only
controls what the client enforces locally and advertises such that the
server knows what it needs to satisfy, so it will be working but just
isnt relevant to your situation.

I think ServiceBus advertises 240seconds for idle-timeout in its Open
frame, meaning its actual idle-timeout in terms of not receiving
actual connection traffic or a heartbeats SHOULD be 480sec, but at
least 240 seconds. As Gordon noted, this doesnt seem to be what the
issue you are seeing relates to and it appears they also have other
higher level definitions of idle (or have a bug in implementation of
the heartbeating related idle-timeout) which you will need to discuss
with the ServiceBus folks.

Robbie

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org