Monday, September 19, 2016

Disable the Task Execution in ESB Cluster Environment


All of us know, one of the key feature of ESB cluster setup is deployment synchronizing. Once you deploy a project in the cluster manager mode, it will sync up with the cluster worker nodes. However, eventually the artifacts will be deployed in manager and worker nodes.

Suppose if we deploy the artifacts having "Task" in the cluster environment, they will be deployed on all the ESB nodes in cluster including manager node. But the task is something like a schedule job. So it will automatically execute in the deployed nodes without any invocation. Simply it will execute in the manager node as well as worker nodes in ESB 4.8.1.

But the issue is basically we are expecting the manager node just do the deployment synchronizing activities and not the service execution. At this point of view, ESB allows us to deploy the tasks in cluster environment and allow the execution of them in predefined nodes. This attribute is called as pinnedServers attribute.
We can specify the pinned server attribute in the task synapse configuration and that will get executed only on that specific pinned servers.

 <?xml version="1.0" encoding="UTF-8"?>  
 <task xmlns="http://ws.apache.org/ns/synapse" name="Task123" class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" pinnedServers="worker1, worker2">  
  </task>  

The worker nodes should be configured as the pinned serversWe just need to add the <ServerName> configuration in axis2.xml in each worker node which required to execute that task and start the server with -DSynapseServerName=<ServerName>

  <!-- Synapse Server name parameter -->  
   <parameter name="SynapseConfig.ServerName" locked="false">worker1</parameter>  

No comments:

Post a Comment