How do I configure an endpoint resolver policy

What policies are available and what do they do

The available policies are located in the following package: org.apache.servicemix.jbi.resolver.

There you will find at this time 3 policies:

FirstChoicePolicy

This policy is the default policy of ServiceMix. It always chooses the first endpoint in a list of available endpoints.

RandomChoicePolicy

This policy chooses an endpoint randomly from a list of available endpoints.

ServiceRoundRobinPolicy

This policy will apply the RoundRobin logic for choosing an endpoint. On a list of available endpoints each message will
be routed to another endpoint if there are more than one endpoints available.

Where do I configure which policy to use

The configuration is done inside the servicemix.xml file. It is located in the conf folder of your ServiceMix installation.
See the example below...

If you don't specify the resolver policy, the FirstChoicePolicy will be used always.

Example setup for Service Round Robin Policy

conf/servicemix.xml
...
</sm:container>

<bean factory-method="getBroker" factory-bean="jbi">
  <property name="defaultServiceChooser">
    <bean class="org.apache.servicemix.jbi.resolver.ServiceRoundRobinPolicy" />
  </property>
</bean>

<audit:jdbcAuditor container="#jbi" autoStart="false">
...
  • No labels