10
Picking the file only once part 2 By Anirban Sen Chowdhary

Picking the files only once part 2

Embed Size (px)

Citation preview

Page 1: Picking the files only once part 2

Picking the file only once part 2

By Anirban Sen Chowdhary

Page 2: Picking the files only once part 2

Sometime I find many people asking how to make the file endpoints in Mule so that it only picks the files from inbound folder only once and then stops.That means it will no more pick any files from the inbound folder.

Page 3: Picking the files only once part 2

So, How can file component picks the file for only 1 time

?

Page 4: Picking the files only once part 2

Yes .. We can .. I will show you this trick .. How ??

Page 5: Picking the files only once part 2

In my previous slide I have shown you by achieving it by stopping the flow at the end This time we will see by stopping the connector at the end

Page 6: Picking the files only once part 2

Let us we have following Mule flow:-

Here you can see we are using Groovy component at the end. Now what this Groovy component will be doing is it will stop the file connector at the end using the following code :- muleContext.getRegistry().lookupConnector('File').stop()

Page 7: Picking the files only once part 2

The corresponding Mule flow will be as follows:-

This time you can see here Groovy component is stopping the File connector once the file has been read. The File connector is defined at the top of the flowOnce the file is read no more files will be read from inbound endpoint as the file connector is stopped

Page 8: Picking the files only once part 2

Now if we start our application we will find that the file connector has picked up the current file from the inbound folder and have stopped. That means if we place files again in the inbound folder it will not work anymore :-

We can see here the file have been placed successfully in the outbound folder.Now no more files will be picked since file connector is stopped

Page 9: Picking the files only once part 2

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 10: Picking the files only once part 2

Thank You