You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Henry Molina <hm...@lapolar.cl> on 2011/11/18 17:44:10 UTC
Timeout of java client
Hi All,
How Can I configure Timeout for java client?
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
Regards
Henry
P Considere el medioambiente antes de imprimir este correo
________________________________
La información contenida en este mensaje y en sus documentos adjuntos, es estrictamente confidencial y privado para sus destinatarios. Cualquier uso, reproducción, divulgacion o distribucion no autorizada de su contenido esta estrictamente prohibida y puede ser sancionado criminalmente. Si ha recibido este correo por error, solicitamos avisar al remitente y eliminarlo de su sistema. EMPRESAS LA POLAR S.A y sociedades relacionadas directa o indirectamente con esta, no sera responsable del uso indebido de este contenido o de los adjuntos al mismo.
Re: Timeout of java client
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:44 AM, Henry Molina <hm...@lapolar.cl> wrote:
> Hi All,
>
> How Can I configure Timeout for java client?
>
>
> 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
>
> Regards
>
> Henry
> P Considere el medioambiente antes de imprimir este correo
>
>
> ________________________________
> La información contenida en este mensaje y en sus documentos adjuntos, es estrictamente confidencial y privado para sus destinatarios. Cualquier uso, reproducción, divulgacion o distribucion no autorizada de su contenido esta estrictamente prohibida y puede ser sancionado criminalmente. Si ha recibido este correo por error, solicitamos avisar al remitente y eliminarlo de su sistema. EMPRESAS LA POLAR S.A y sociedades relacionadas directa o indirectamente con esta, no sera responsable del uso indebido de este contenido o de los adjuntos al mismo.
>
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org