On Tue, Jan 5, 2010 at 4:48 PM, Jen Andre <jan...@gmail.com> wrote:
>
> Yes, I am using both the c++ broker and the java library from 0.5.
>
> Setting the idle_timeout in the AMQP url doesn't seem affect anything.
>  I will try grabbing the latest from trunk as suggested by another
> user.
>
> I'm not sure which API I'm supposed to be using.  I tried both the
> code in  org.apache.qpid.client.* and  org.apache.qpid.transport.* and
> I get the same behavior.

You are supposed to use the JMS API.
The classes you are using right now are in the implementation layer
and are subject to change without any notice btw versions.

> Here some sample code.  Maybe you can tell me what I'm doing wrong

I cut paste your code and added an exception listener to the
connection and I didn't see any timeouts.

If I did a kill -STOP <broker-pid> then I saw a the client dropping
the connection after 120 secs.

> (192.168.10.128 is the IP address of the broker):
>
>
>        String url =
>
> String.format("amqp://%s:%...@%s/?brokerlist='tcp://%s:%d?idle_timeout='60''&clientid=%s&ssl=%s",
>                    "guest", "guest", "192.168.10.128",
> "192.168.10.128", 5672, "myid",
>                    false);
>
>            log.debug("url: " + url);
>
>            AMQConnection c = new AMQConnection(url);
>
>            try {
>
>                final AMQSession session = (AMQSession)
> c.createSession(false, AMQSession.AUTO_ACKNOWLEDGE);
>
>                // make the queue name same as the binding key, make it durable
>
>                AMQDestination queueDestination = new AMQTopic(new
> AMQShortString("amq.topic"),
>                        new AMQShortString("myBindingKey"),
>                        false,
>                        new AMQShortString("myBindingKey"),
>                        true);
>
>
>                c.setIdleTimeout(0);
>
>                log.info("Binding to " + "myBindingKey");
>
>                session.declareAndBind(queueDestination);
>
>                MessageConsumer consumer =
> session.createExclusiveConsumer(queueDestination);
>
>                consumer.setMessageListener(new MessageListener() {
>
>                    public void onMessage(Message arg0) {
>                       System.out.println("Got message...");
>                    }
>                    }
>                );
>
>
>                c.start();
>
>                Thread.sleep(1000 * 360); // sleep 360 seconds to trigger issue
>
>                session.close();
>
>            } finally {
>
>                c.close();
>            }
>
>
> Thanks!
> -Jen
>
> On Tue, Jan 5, 2010 at 2:31 PM, Rajith Attapattu [via Apache Qpid
> users] <ml-node+4256885-2125845...@n2.nabble.com> wrote:
>> Hello Jean,
>>
>> It appears that you are using the C++ broker and the java client.
>> Could you confirm which version you are using?
>>
>> On Tue, Jan 5, 2010 at 12:47 PM, Jen Andre <[hidden email]> wrote:
>>>
>>> Hello,
>>>
>>> I have a Java client listener that subscribes to a topic and waits for
>>> messages.  I'm noticing after 120 seconds of idle time  (no messages
>>> received) the connections time out (here's what I see in syslog messages
>>> for
>>> qpidd)
>>>
>>> qpidd[3472]: 2010-01-01 16:46:20 error Connection timed out: closing
>>>
>>> This is consistent with the debug messages I'm seeing on the client side:
>>>
>>> IoReceiver - /192.168.10.128:5672 2010-01-05 12:32:10,126 WARN
>>> [apache.qpid.transport.ClientDelegate] Ignoring the idle timeout 0 set by
>>> the connection, using the brokers max value 120
>>>
>>> and
>>>
>>>
>>> IoReceiver - /192.168.10.128:5672 2010-01-05 12:38:57,898 DEBUG
>>> [apache.qpid.transport.Connection] RECV: [conn:9ced8e] ch=0
>>> ConnectionHeartbeat()
>>> IoReceiver - /192.168.10.128:5672 2010-01-05 12:40:57,899 DEBUG
>>> [apache.qpid.transport.Connection] RECV: [conn:9ced8e] ch=0
>>> ConnectionHeartbeat()
>>> IoReceiver - /192.168.10.128:5672 2010-01-05 12:40:58,618 DEBUG
>>> [apache.qpid.transport.Connection] connection closed: conn:9ced8e
>>>
>>>
>>> I'm a bit confused on how timeouts and heartbeats are supposed to work.
>>> Does the client force the disconnect, or the server, or both, if the
>>> heartbeats are not received in a specific period of time?
>> Both the client and the broker could enforce a disconnect if they
>> don't see any activity during two consecutive heartbeat intervals.
>>
>>  Do both peers
>>> send heartbeats? (this seems to imply it does.
>> Both peers do send a heartbeat.
>> The JMS client (0-10 version which you are using against the c++
>> broker) will echo a heartbeat in response to one sent by the broker.
>>
>>> http://qpid.apache.org/configure-broker-and-client-heartbeating.html).
>> The link you provided is for the JMS Client (0-8 version) and the Java
>> Broker.
>> At the moment it's slightly different from JMS Client (0-10) and c++
>> broker combination.
>>
>> The amqj.heartbeat.delay is only effective for the 0-8 codepath.
>> If you need to set the idle timeout for the 0-10 client you need to
>> set it in the broker URL as follows
>>
>> amqp:///test?brokerlist='tcp://anotherhost:5684?idle_timeout='60''
>> Please note the idle_timeout is in secs and not in milisecs.
>>
>> We are working on consolidating the configuration and behaviour of the
>> JMS client for both 0-8/9 and 0-10 versions.
>>
>>> I do notice that while I see a lot of RECV: heartbeat debug messages on
>>> the
>>> client side, I don't see any SEND: messages that indicates it's sending
>>> them
>>> to server.   If the client is supposed to send them to the server
>>> periodically to ensure the connection stays alive, how can I ensure this
>>> is
>>> happening? (setting system property amqj.heartbeat.delay seems to have no
>>> effect).
>>>
>>> Thanks!
>>> Jen
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/timeouts-tp4256406p4256406.html
>>> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> Apache Qpid - AMQP Messaging Implementation
>>> Project:      http://qpid.apache.org
>>> Use/Interact: mailto:[hidden email]
>>>
>>>
>>
>>
>> --
>> Regards,
>>
>> Rajith Attapattu
>> Red Hat
>> http://rajith.2rlabs.com/
>>
>> ---------------------------------------------------------------------
>> Apache Qpid - AMQP Messaging Implementation
>> Project:      http://qpid.apache.org
>> Use/Interact: mailto:[hidden email]
>>
>>
>>
>> ________________________________
>> View message @ http://n2.nabble.com/timeouts-tp4256406p4256885.html
>> To unsubscribe from timeouts, click here.
>>
>
> --
> View this message in context: 
> http://n2.nabble.com/timeouts-tp4256406p4257648.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>



-- 
Regards,

Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscr...@qpid.apache.org

Reply via email to