Quartz application in Mule cluster without JobStore

925 views Asked by At

We currently have a on premises cluster environment where we currently have 2 node clustered. We are using Mule 3.8.2 runtime. We are aware that quartz is not a cluster aware and after a google search, we found if we deploy quartz in a cluster it will trigger from both the nodes simultaneously. So for that we need to configure JDBC Job Store in quartz

To test it I have deployed the following Mule flow in the cluster without any job store:

<quartz:connector name="QuartzConn" validateConnections="true" doc:name="Quartz">
    <receiver-threading-profile maxThreadsActive="1"/>
</quartz:connector> 
 
<flow name="TestFlow" processingStrategy="synchronous">
    <quartz:inbound-endpoint name="connectorname" jobName="testjob" repeatInterval="10000"
                responseTimeout="10000" doc:name="QuartzConn" connector-ref="QuartzConn">
        <quartz:event-generator-job>
            <quartz:payload>This is a test payload</quartz:payload>
        </quartz:event-generator-job>
    </quartz:inbound-endpoint>
    <logger message="Server Name:- #[server.ip+'\n'] This is a message #[function:now]" level="INFO" doc:name="Logger"/>
    <file:outbound-endpoint path="E:\test" outputPattern="#[server.dateTime.format('YYYY-MM-dd-hh-mm-ss.sss')].txt" responseTimeout="10000" doc:name="File"/>
</flow>

But to my surprise I found, only one node is currently executing the quartz and the file was written in target folder with timestamp, while other node was silently waiting and was doing nothing!!!

Node1 was writing all the file :

enter image description here

While Node2 was silently waiting and observing:

enter image description here

(images are attached)

So, to test further, I shutdown Node1 and I found Node2 started picking the task and was writing the file.

Please node this is a simple quartz application without any jdbc job store configured. So, how can I explain this action? both of the nodes are configured with mmc and performing well.

If somebody could explain the quartz in cluster in more details, it would be helpful.

Thanks

2

There are 2 answers

2
Nitin Gaur On BEST ANSWER

If you want to just try out its fine but with Mule cluster you don't need to add Quartz, instead use Poll scope. Probably presence of Mule cluster has enabled quartz clustering without JDBC job store. However, in non-clustered Mule setup (we have 2 non-clustered nodes), Quartz cluster with JDBC job store is only option.

Mulesoft is playing smart. They have added Poll scope which is good but in typical Production environment with at least 2 nodes, you want only one node to poll. This is only possible if you buy Mule's cluster known as High Availablity but that is available in Platinum subscription only (not in Gold). So, indirectly Mulesoft forcing customer to buy or upgrade to Platinum subscription to fetch more money out of same product.

0
Nitin Gaur On

"I don't want to use poll, as I need to know the reason of it's working"...well that is your choice but Mule documentation clearly states that Poll scope is preferred in clustered environment.

Whereas in non-clustered environment, you can use Quartz with JDBC jobstore to achieve same functionality, bit complex though. Explained here and here