Hello,
The reason that camel does not stop the route directly is that there
are inflight messages in the route.
Setting the timeout to 1 will shorten the time camel wait for the
inflight messages to be processed so there is a risk that by doing
this messages will be lost.
Another approch could be that you create your own filter bean that can
be updated dynamicly with a new expression.
So if you change your route to something like this
from("seda:sometag?multipleConsumers=true")
.routeId(RouteIdCreator.createRouteId(toIP, toPort, "sometag"))
.filter().bean("myFilter")
.unmarshal().jaxb("sometag")
.marshal().json().wireTap("mina:udp://client_ip_address:20001?sync=false");
Then register a bean called myFilter that implements predicter. That
does somthing like this...
public class MyFilter implements Predicate {
private Map<String, String> routeFilterMap = new HashMap<String,
String>();
public void addFilter(String routeId, String expression) {
routeFilterMap.put(routeId, expression);
}
@Override
public boolean matches(Exchange exchange) {
String expression =
routeFilterMap.get(exchange.getFromRouteId());
if ( expression != null ) {
// return the result of the evaluated expression
} else {
return false;
}
}
}
Then you can update the expression in runtime by calling the
addFilter() method from another route.
// Pontus
On Sun, Jul 29, 2012 at 2:14 PM, soumya_sd <[email protected]> wrote:
> I found a solution for this.
>
> I added the following and now the Camel forces the route to shutdown in 1
> seconds (timeout time) instead of the default 300 seconds.
>
> <bean id="shutdown"
> class="org.apache.camel.impl.DefaultShutdownStrategy">
> <property name="timeout" value="1" />
> </bean>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Options-for-creating-dynamic-filters-tp5716584p5716585.html
> Sent from the Camel - Users mailing list archive at Nabble.com.