0

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?

aled
  • 21,330
  • 3
  • 27
  • 34
Rakesh
  • 104
  • 1
  • 11
  • What is the deployment model? Are you deploying on cloudhub or on cloud? Also, if it is cloudhub, do you use any other cloud platform like AWS / azure etc? – Harshank Bansal May 26 '22 at 07:19
  • its on cloudhub – Rakesh May 26 '22 at 08:56
  • 1
    Do you use other cloud provider, like aws/azure. What you are trying to achieve is not possible solely using **Mule 4**. However, many cloud providers provide services (like AWS eventbridge), that you can use to create these schedulers, and invoke external endpoints, like on cloudhub. – Harshank Bansal May 26 '22 at 09:13
  • If you are using Mule 3 you may have some hope: [Generating flows dynamically](https://help.mulesoft.com/s/article/Creating-dynamic-flows-at-runtime) but it is not a recommended thing to do. – Harshank Bansal May 26 '22 at 09:16
  • 1
    Why do people keep confusing Mule with MuleSoft? I fixed the title – aled May 26 '22 at 11:40
  • @HarshankBansal you may consider writing your comments in the form of an answer. – aled May 26 '22 at 12:48
  • @aled I want to give a complete answer, but its only possible if OP can tell if he uses any cloud provider. If I don't find it, I will post one with whatever I know – Harshank Bansal May 26 '22 at 12:54
  • 2
    If you know an answer using a cloud provider I believe that is valid to share. It may be useful for others, or OP may want to use a provider if they are currently not using. Clarifying that there is no pure Mule/CloudHub solution is also an answer. – aled May 26 '22 at 13:45

2 Answers2

2

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.

aled
  • 21,330
  • 3
  • 27
  • 34
2

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.

aled
  • 21,330
  • 3
  • 27
  • 34
Harshank Bansal
  • 2,798
  • 2
  • 7
  • 22