Is there any way to create dynamic scheduler jobs (flows) in Mule deployed on CloudHub?

767 Views Asked by At

We have a scheduler flow already which runs on some times specified. Now for a new client we need the same flow to work.

Without having to add a new scheduler and duplicate the scheduler component with new details, is there any way to dynamically create those in Mule without redeploying the application? Or any other ways to achieve the functionality?

2

There are 2 best solutions below

0
On

What you are trying to achieve is not possible solely using Mule 4 or CloudHub. However, you can meet your requirement by combining with a scheduler service from any cloud provider. For example AWS's Amazon event bridge or GCP's Cloud Scheduler

So, in your Mule APP, you will replace your scheduler with an HTTP Listener (<http:listener>). Then, in your scheduler service, add a scheduler and configure it to send POST request to this HTTP endpoint. This POST request can have the required data that your mule app will need to identify the client, and perform customized action based on it. This way, whenever you want to add another client, you can just create a new scheduler in your cloud provider without needing to touch the mule application.

0
On

There is no out of the box way to create dynamically schedulers in Mule 4. An alternative is to develop your own message source in a custom connector to trigger the flow using the Mule Java SDK. Note that your custom connector will not be recognized as a scheduler in CloudHub UI. If you want to be able to manage you will have to implement an alternative.