Does camel have a pattern for a dynamic consumer similar to the dynamic router?
I'd like to create and remove consumers dynamically (at runtime) through some trigger such as a timer or event (such as a user interface).
For example,
private class DynamicConsumer {
int i=0;
// this will get called on each time event
public static String[] getEndpoints() {
if (i ==0) {
// dont consume
return null;
} else if (i % 2 == 0) {
return new String[] {"activemq:topic:ABC","activemq:topic:CDE"}
} else {
return new String[] {"activemq:topic:FGH" };
}
}
}
from("timer://...")
.dynamicConsumer(bean(new DynamicConsumer())
.to("direct:destination");
No there is no such pattern