Created
March 5, 2018 13:22
-
-
Save ricston-git/bb3844da7efcc4a6d53fee23269eae7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException | |
{ | |
muleContext = getMuleContext(jobExecutionContext); | |
if (muleContext.isPrimaryPollingInstance() || | |
TRUE.equals(jobExecutionContext.getJobDetail().getJobDataMap().get(PROPERTY_JOB_DYNAMIC))) | |
{ | |
doExecute(jobExecutionContext); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<custom-connector name="CustomPollingConnector" class="org.mule.transport.polling.MessageProcessorPollingConnector"> | |
<service-overrides messageReceiver="com.ricston.blogs.polling.NonClusterAwarePollingMessageReceiver"/> | |
</custom-connector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NonClusterAwareJob extends EventGeneratorJob { | |
@Override | |
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { | |
doExecute(jobExecutionContext); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NonClusterAwarePollingMessageReceiver extends MessageProcessorPollingMessageReceiver { | |
/** Constructors **/ | |
/** | |
* A method which ignores the cluster member state and performs the polls regardless. | |
* Returning 'true' (i.e. the default value in the super-class) will cause only primary node to poll. | |
* Returning 'false' will cause ALL nodes in the cluster to poll. | |
*/ | |
@Override | |
protected boolean pollOnPrimaryInstanceOnly() { | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<flow name="sample-quartz-flow"> | |
<quartz:inbound-endpoint address="quartz://myJob?jobDynamic=true" repeatInterval="60000" doc:name="Quartz Poll"> | |
<quartz:event-generator-job> | |
<quartz:payload>Sample Job data</quartz:payload> | |
</quartz:event-generator-job> | |
</quartz:inbound-endpoint> | |
<logger message="#[payload]" level="INFO" doc:name="Log payload"/> | |
</flow> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment