camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ondrej_Fialka <ondrej.fia...@gmail.com>
Subject How to set QPID parameters (e.g. durable=true) to Camel AMQPComponent?
Date Wed, 01 Oct 2014 09:01:18 GMT
Hello, 
Can I ask for help, please?

I use Camel to route messages between various email, ftp and web service
endpoints. I want to add AMQP support as well. Recently I use RabbitMQ but I
want the application to handle any AMQP 0.9.1 broker. 

The problem is I did nor find any way how to set parameters like
/durable=true/ to the AMQPComponent. I know QPID can use these parameters,
but don't know how to pass them from Camel to QPID.
If I want to connect to a durable queue it fails on incompatible parameters.
This is because AMQP Component is inherited from JMSComponent and this
component does not accept the necessary parameters.

I construct the connection dynamically as Spring bean from configuration
file (this works):

/
String CONNECTION_STRING = "amqp://%s:%s@%s/%s?brokerlist='tcp://%s:%s'";

...

amqpFactoryName = "amqConnectionFactory-" + code;
		endpointPrefix = "amqp-" + code;

constructorArguments.addIndexedArgumentValue(0, connectionString,
"java.lang.String");
	
amqpConnectionFactoryBeanDefinition.setConstructorArgumentValues(constructorArguments);		
		amqpConnectionFactoryBeanDefinition.setAutowireCandidate(true);
		registry.registerBeanDefinition(amqpFactoryName,
amqpConnectionFactoryBeanDefinition);	
		
		GenericBeanDefinition amqpComponenetBeanDefinition = new
GenericBeanDefinition();
		amqpComponenetBeanDefinition.setBeanClass(AMQPComponent.class);
		amqpComponenetBeanDefinition.setAutowireCandidate(true);
		
		MutablePropertyValues values = new MutablePropertyValues();
		values.addPropertyValue("connectionFactory", new
RuntimeBeanReference(amqpFactoryName)); 		
		amqpComponenetBeanDefinition.setPropertyValues(values);
		
		registry.registerBeanDefinition(endpointPrefix,
amqpComponenetBeanDefinition);/

The Camel route is defined like this:

/from("amqp-in://BURL:direct://amq.direct//MyQueue")
.to(...)/
This works well. But if the queue I want to connect to is durable, I tried: 

/amqp-in://BURL:direct://amq.direct//MyQueue?durable=true/

this fails:
/Failed to resolve endpoint:
amqp-IN://BURL:direct://amq.direct//MyQueue?durable=true  There are 1
parameters that couldn't be set on the endpoint. Check the uri if the
parameters are spelt correctly and that they are properties of the endpoint.
Unknown parameters=[{durable=true}]/

I found out why it fails, but don't know how to make it work.

Is there any way to set the paramaters to the underlying QPID component? Or
a different way to solve this? As I sad, I would like to use generic AMQP
approach, not just RabbitMQ.

Thank you, any help is appreciated.

Ondrej




--
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-QPID-parameters-e-g-durable-true-to-Camel-AMQPComponent-tp5757266.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message