You must define a separate seda
route that is distributing your message to the esper engine such as (using the fluent style):
public final void configure() throws OperationNotSupportedException{
from("xmpp://localhost:5222/?blablabla...")
.filter().method(...)
.process(...)
.to("seda:sub");
from("seda:sub?concurrentConsumers=10)
.to("esper://session_X");
}
That said, seda
should only be used if loosing messages is not a problem. Otherwise you should use a more robust protocol such as jms
that allows to persist messages.
EDIT:
Beside seda
, you could use threads()
, where you could customize the threading behaviour by defining an ExecutorService
:
public final void configure() throws OperationNotSupportedException{
from("xmpp://localhost:5222/?blablabla...")
.filter().method(...)
.process(...)
.threads()
.executorService(Executors.newFixedThreadPool(2))
.to("esper://session_X");
}
If you using seda
or threads()
, you may loose transaction safety in case of failures. For this case or if you need to balance the workload to several remote hosts, you may use jms
. More information about this solution is found here.