Skip to content

Instantly share code, notes, and snippets.

@germanrsolis
Created October 26, 2012 13:34
Show Gist options
  • Save germanrsolis/3958862 to your computer and use it in GitHub Desktop.
Save germanrsolis/3958862 to your computer and use it in GitHub Desktop.
How to control if the current node is the primary polling instance
<flow name="main">
<jms:inbound-endpoint queue="in" />
<!-- check if this application is running in the primary pooling instance -->
<choice>
<when evaluator="groovy" expression="muleContext.isPrimaryPollingInstance() == true">
<!-- process the message -->
<append-string-transformer message=" Received" />
<logger level="INFO" message="#### IS PRIMARY POLLING INSTANCE, PROCESSING THE MESSAGE" />
<vm:outbound-endpoint path="out"/>
</when>
<otherwise>
<!-- put the message back in the queue (you'd need to copy the INBOUND PROPERTIES in the OUTBOUND SCOPE so you don't loose them)-->
<jms:outbound-endpoint queue="in" />
</otherwise>
</choice>
</flow>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment