How to restrict ESB Service to use limited set of specific threads on SOA 5?
Issue
We use something like this:
ServiceInvoker serviceInvoker = new ServiceInvoker(destinationServiceCategory, destinationServiceName);
Message message = composeMessageContainingServiceUrlDependingOnInput();
serviceInvoker.deliverAsync(message);
...in order to call the following JBoss ESB Service (simplified):
<service category="transactions" description="Sends the transaction to subscribed customers"
invmScope="NONE" name="transactionSender">
<listeners>
<jms-listener busidref="transactionSenderChannel"
maxThreads="5" name="queueListener"/>
</listeners>
<actions mep="OneWay">
<action class="my.custom.Action" name="callService"/>
</actions>
</service>
The custom action has to invoke an external stateful protocol, which is not thread-safe. Therefore, we need to limit the number of threads executing this service to one.
I have tested this by setting maxThreads to 1. What I see is that this limits the number of parallel Threads executing the Action simultaneously. However, that Thread may be a different one on every invocation. This is a problem for our custom action, as the initialization of the external resource should only happen once.
How can we limit the number of different threads used for the service, if the
Environment
- Red Hat JBoss SOA Platform
- 5.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.