Mule with quartz

11
By Anirban Sen Chowdhary

Transcript of Mule with quartz

Page 1: Mule with quartz

By Anirban Sen Chowdhary

Page 2: Mule with quartz

Quartz transport can be used in Mule application to schedule an event to take place.An inbound quartz endpoint can be used to trigger inbound events that can be repeated, such as every second. Outbound quartz endpoints can be used to schedule an existing event to fire at a later date. Users can create schedules using cron expressions, and events can be persisted in a database.

Source: MuleSoft

Page 3: Mule with quartz

Cron Expressions: A cron expression is a string comprised by six or seven fields separated by white space. Fields can contain any of the allowed values, along with various combinations of the allowed special characters for that field.We can use cron expressions to create schedulersExample of cron expression :Cron expressions can be as simple as this:* * * * ? *or more complex, like this:0 0/5 14,18,3-39,52 ? JAN,MAR,SEP MON-FRI 2002-2010.

Source: MuleSoft

Page 4: Mule with quartz

Jobs :- Jobs are used to perform an action when a time trigger occurs from the Quartz transport. Mule provides a number of jobs for generating and scheduling events.

Source: MuleSoft

Page 5: Mule with quartz

Now let’s test an application with Quartz

Page 6: Mule with quartz

Let’s suppose we have a simple application designed to write a file to an outbound endpoint at a specific interval of time as follow :-

Page 7: Mule with quartz

The mule config will be as follow :-

As you can see the flow is designed to write a file to a folder at a specific interval of time

Page 8: Mule with quartz

We start and run our application as follow:-

We can find the application has start working and the Quartz is making the flow to write the file in the outbound endpoint after each specific interval of time

Page 9: Mule with quartz

In the outbound folder you can see the files are generated at each interval of time:-

Page 10: Mule with quartz

In my next slide I will bring some other techniques in Mule implementation .Hope you have enjoyed this simpler version.Keep sharing your knowledge and let our Mule community grow

Page 11: Mule with quartz