2

In Mule 4 is there any any way to run the Mule-Batch in synchronous Mode

I have done several projects using mule batch component. Now present case we have a situation where need to dependent on the output produced by the mule batch component.For my case it is creating a file in asynchronous mode which contains the below information.

studentId,Name,Status 1,bijoy,enrolled 2,hari,not_enrolled, 3,piyush,erolled

But as it is running in asynchronous mode could not rely on the data. My question is is there any way to run mule Batch (Mule 4) synchronously?

aled
  • 21,330
  • 3
  • 27
  • 34

1 Answers1

2

No, it is not possible to run a Batch synchronously within the flow it is called, by design.

As an alternative you could put the logic that you want to execute after the batch in a separate flow that listens to a VM queue. In the On Complete phase of the batch you can send a message to that VM queue. The listening flow can't receive batch data directly but for a file it should be OK.

Having said that, file exchange is not a very good method of exchanging information inside an application. I would recommend to explore alternatives like databases for transient data, unless you just need the file to send it elsewhere.

aled
  • 21,330
  • 3
  • 27
  • 34
  • yes the comment is true . What I have created a mule schedular which triggers a job on every 5 mins and . by using the mule batch component I dump the output on a object store. and from another mule rest api just call the object store . So that I although can't get the real time data but as the mule batch runs in every 5 minutes so that job store is populated with almost updated data and use it. – Biltu - Technology Jan 12 '22 at 19:01
  • that implementation has the issue of may not be concurrent safe. If the batch job needs more that 5 minutes, will it override the previous execution? Also Object Stores have some limitations. If they impact your application will depend on the specific use case. – aled Jan 12 '22 at 19:45