You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Gaston Quezada <qu...@gmail.com> on 2011/11/18 17:17:20 UTC
How do I contifure clien qpid Timeout for java?
Dear Friends
How do I configure client qpid Timeout for java?
i am using qpid-client-0.12 with amqp version 0.10 and using asyncronous
listener
My code:
public void toConsumer() throws AMQPConsumerException {
try{
AMQConnectionFactory factory = new
AMQConnectionFactory(SWProperties.getString("connectionfactory.qpid",
System.getProperty(type + "sw.properties")));
this.connection = factory.createConnection();
this.connection.start();
/*
*
* creamos el consumidor
* de colas y agregamos
* cliente al manejador
* de eventos
* MessageListener
**************************
*/
AMQShortString exchangeName = new
AMQShortString(SWProperties.getString("exchange.output",
System.getProperty(type + "sw.properties")));
AMQShortString queueName = new AMQShortString(this.replyTo);
AMQShortString routingkeyName = new AMQShortString(this.replyTo);
System.out.println("exchangeName|" + exchangeName);
System.out.println("queueName|" + queueName);
System.out.println("routingkeyName|" + routingkeyName);
AMQQueue queue = new AMQQueue(exchangeName, routingkeyName,
queueName, false, false, false);
Session session=
this.connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
MessageConsumer messageConsumer = session.createConsumer(queue);
messageConsumer.setMessageListener(this);
this.shutdownHook.await();
synchronized (this){try{this.wait(25);}catch (InterruptedException
ie){}}
this.connection.close();
}
catch (Exception e){throw new AMQPConsumerException(e);}
}//fin-metodo
Thanks
--
Gastón Quezada
Re: How do I contifure clien qpid Timeout for java?
Posted by Rajith Attapattu <ra...@gmail.com>.
You could use -Dqpid.heartbeat=x or use heartbeat as a broker url property.
Btw, Please don't use the AMQ** classes. These are internal classes
that will not be there going forward.
It's better to use the JMS interfaces.
Rajith
On Fri, Nov 18, 2011 at 11:17 AM, Gaston Quezada
<qu...@gmail.com> wrote:
> Dear Friends
>
> How do I configure client qpid Timeout for java?
>
> i am using qpid-client-0.12 with amqp version 0.10 and using asyncronous
> listener
>
> My code:
>
> public void toConsumer() throws AMQPConsumerException {
> try{
>
> AMQConnectionFactory factory = new
> AMQConnectionFactory(SWProperties.getString("connectionfactory.qpid",
> System.getProperty(type + "sw.properties")));
>
> this.connection = factory.createConnection();
> this.connection.start();
>
> /*
> *
> * creamos el consumidor
> * de colas y agregamos
> * cliente al manejador
> * de eventos
> * MessageListener
> **************************
> */
> AMQShortString exchangeName = new
> AMQShortString(SWProperties.getString("exchange.output",
> System.getProperty(type + "sw.properties")));
> AMQShortString queueName = new AMQShortString(this.replyTo);
> AMQShortString routingkeyName = new AMQShortString(this.replyTo);
>
> System.out.println("exchangeName|" + exchangeName);
> System.out.println("queueName|" + queueName);
> System.out.println("routingkeyName|" + routingkeyName);
>
> AMQQueue queue = new AMQQueue(exchangeName, routingkeyName,
> queueName, false, false, false);
> Session session=
> this.connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
> MessageConsumer messageConsumer = session.createConsumer(queue);
>
> messageConsumer.setMessageListener(this);
> this.shutdownHook.await();
> synchronized (this){try{this.wait(25);}catch (InterruptedException
> ie){}}
>
> this.connection.close();
>
> }
> catch (Exception e){throw new AMQPConsumerException(e);}
> }//fin-metodo
>
>
>
> Thanks
> --
> Gastón Quezada
>
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org