+1, this is an important feature for the new rider of camel :)
On 4/23/11 11:26 PM, Claus Ibsen wrote:
We might wanna add a check in the filter eip that it has child
processors. So it would fail starting in this case. We do have that
for some of the other eips
On Saturday, April 23, 2011, Mark Doyle<markjohndo...@googlemail.com> wrote:
Argh! So simple :D
Thanks, Ben, worked perfectly.
On 23 April 2011 15:46, Ben O'Day<ben.o...@initekconsulting.com> wrote:
put the<to> before the closing</filter> tag...
_______________
Ben O'Day
On Apr 23, 2011, at 5:39 AM, Mark Doyle<markjohndo...@googlemail.com> wrote:
Hi all,
I'm having a little trouble with a dynamically filtered route.
My route is defined in Spring as follows:
<!--The came route used to retrieve packets for the gui. Can be altered -->
<camelContext id="camelContextBean"
xmlns="http://camel.apache.org/schema/spring">
<route id="fromJmsProcessedParametersOut" autoStartup="false">
<from uri="jms:topic:processedParametersOut" />
<camel:filter>
<camel:method bean="parameterFilterer"></camel:method>
</camel:filter>
<to uri="bean:camelParameterProvider?method=parameterIn" />
</route>
</camelContext>
The filter bean has a method called matches which is being called by
camel. The method is as follows:
public final boolean matches(@Header("ParameterName") final String
headerParameterName) {
boolean result = false;
if (this.parameterNames == null) {
result = true;
}
else if (parameterNames.size()> 0) {
for (String parameterName : parameterNames) {
System.out.println(parameterName + " : " + headerParameterName);
// if the filter name matches the parameter in this message header
if (StringUtils.equals(parameterName, headerParameterName)) {
System.out.println("Filter match for " + parameterName
+ " : " + headerParameterName);
result = true;
}
}
}
System.out.println("Returning " + result);
return result;
}
Now, according to the System outs the returns are correct. If I change
the parameterNames Set at runtime the filter processes the list and
returns the correct true or false flag. The problem is that Camel
still routes every message.
Can anybody see any reason why this design will not work or whether
I've missed something in implementing it.
Thanks!
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com