camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhowlett <>
Subject RecipientList with bean method to set HTTP endpoint string
Date Mon, 09 Jul 2012 19:46:39 GMT
I'm using the Java DSL to do something akin to the following:

	.recipientList(method(MyBean.class, "myMethod"))

MyBean's myMethod() method is intended to calculate the HTTP endpoint to

public String myMethod(
	@Body String body, 
	@Headers Map<String, Object> inHeaders,
	@OutHeaders Map<String, Object> outHeaders,
	Exchange exchange
) {
	outHeaders = inHeaders;

	outHeaders.put(Exchange.HTTP_METHOD, "GET");

	return "";

The problem is because the body of the Exchange's In Message going into the
recipient list method is not null, an InvalidPayloadException is therefore

Setting the body within the method has no effect because it seems the
component used by the method's return value is passed the pre-recipient list
method's body.

What I'm doing now is using two methods, one pre-recipientList method to
calculate/set the headers etc., and the recipientList's method itself just
returns the HTTP string now. 

What better ways are there of doing this? It would be nice to solve it with
one method. Use the HTTP component class directly?

Thanks, R

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message