Now let us add the maxThreads
property to our InVM service and see how that affectsour output:
jboss-esb.xml
file and add the maxThreads
property with a value
of 5
:<service category="Chapter5Sample"
description="Chapter5 B Service"
invmScope="GLOBAL" name="Chapter5BService">
<property name="maxThreads" value="5"/>
<property name="inVMLockStep" value="true"/>
<property name="inVMLockStepTimeout" value="4000"/>
<actions mep="OneWay">
<action class="org.jboss.soa.esb.samples.chapter5.MyAction"
name="lockStepAction" process="lockStepAction"/>
<action class="org.jboss.soa.esb.actions.SystemPrintln"
name="printMessage">
<property name="message" value="Incoming to B"/>
</action>
</actions>
</service>
src
folder and expand it till the SendLockStepMessage.java
file is displayed in the tree. Now click Run | Run As | Java Application.The following is the server console output from a sample run:
15:30:49,687 INFO [STDOUT] Routing to B 15:30:49,718 INFO [STDOUT] Routing to B 15:30:49,718 INFO [STDOUT] Routing to B 15:30:49,718 INFO [STDOUT] Routing to B 15:30:49,718 INFO [STDOUT] Routing to B 15:30:49,718 INFO [STDOUT] Routing to B 15:30:51,703 INFO [STDOUT] Incoming to B: 15:30:51,703 INFO [STDOUT] [Chapter 5 says Hello!]. 15:30:51,718 INFO [STDOUT] Incoming to B: 15:30:51,718 INFO [STDOUT] [Chapter 5 says Hello!]. 15:30:51,718 INFO [STDOUT] Routing to B 15:30:51,718 INFO [STDOUT] Incoming to B: 15:30:51,718 INFO [STDOUT] [Chapter 5 says Hello!]. 15:30:51,718 INFO [STDOUT] Routing to B 15:30:51,718 INFO [STDOUT] Incoming to B: 15:30:51,718 INFO [STDOUT] [Chapter 5 says Hello!]. 15:30:51,718 INFO [STDOUT] Routing to B 15:30:51,718 INFO [STDOUT] Incoming to B: 15:30:51,718 INFO [STDOUT] [Chapter 5 says Hello!]. 15:30:51,718 INFO [STDOUT] Routing to B 15:30:53,718 INFO [STDOUT] Incoming to B: 15:30:53,718 INFO [STDOUT] [Chapter 5 says Hello!]. 15:30:53,718 INFO [STDOUT] Incoming to B: 15:30:53,718 INFO [STDOUT] [Chapter 5 says Hello!]. 15:30:53,718 INFO [STDOUT] Incoming to B: 15:30:53,718 INFO [STDOUT] [Chapter 5 says Hello!]. 15:30:53,718 INFO [STDOUT] Incoming to B: 15:30:53,718 INFO [STDOUT] [Chapter 5 says Hello!]. 15:30:53,718 INFO [STDOUT] Incoming to B: 15:30:53,718 INFO [STDOUT] [Chapter 5 says Hello!].
You increased the InVM listener threads for our Chapter5Bservice
from 1
to 5
. Notice that the Routing to B message is displayed five times initially and the sixth is blocked until another listener thread becomes available. Although Chapter5Service
picked up its sixth message to route it to Chapter5Bservice
it has been blocked and hence the seventh message is picked up only after two seconds.