Welcome back. In this video, I want to tell more about watermarking. So actually, in earlier video, you saw how I configured watermarking for my file endpoint. Let me open the properties. maximize it. Yep.
So here you can see, I are configured watermark models, modified timestamp. That means if the file is modified, then it will pick up again, otherwise it will not pick up as it. So let me start this application and observe its behavior. I'll read Started, actually and I have restarted. So do you expect that the file will be processed for the first time again? Since I restarted?
Yes, because I restarted, how can I expect mule to remember the state of earlier run? Let us see what will happen if I still running? I'll wait for some time. Okay, so the application started, but he's a file reprocessed now. So even though after restart, how is this file and point remembering the previous watermarking details? So let me tell you actually, what happened.
Actually, whenever I run my application said embedded mule runtime I want you to observe the console. What is the mule hump? So, under plugins, he server slash mule right Actually, this is a location of mule mule which is considered as a mule home. So, let me open this here there is dot mule folder like earlier also when I was running my standard standalone runtime I told you that.mil folder will contain the instance details, the Moodle instance state specific details if I go inside.mil you can see that my current project folder is there. And inside this there will be something called as object store. Basically the watermarking details what are the details of what remarking I configured the file endpoint to store updated timestamp modified timestamp, right.
So the modified timestamp details will be stored in object store under this folder. A lot of temporary folders which are got created right. So the state is stored here inside.mil folder. So when I restart my mule application also the previous object store state is retained. Now during production, that's okay. But during development, I want the file to be reprocessed to try out.
Music. So during development, what I have to do is while running, there's an option to clear the metadata. So let me show you I'll stop this mule application right now here. While running, I'll right click on the project again. Run as mule application configure and select this I will actually maximize this window. A lot of other options down.
Here there is something called clear application data. By default it is configured as never. I'll select it as prompt. And it will prompt me whether to clear application data or not. Now have applied and I'll set run whenever I run. It will prompt me now from now onwards.
Let's wait until it starts. I restarted Yep, now you saw the pop up. Do you want to clear the application Yes. Now, the application metadata from the object store will be deleted and it will start firstly. So the file should be processed for first time again, let us see the application starting, I just pause the video and read starts. Yep, the file got processed and we can see the output on the console.
Okay. So now you see that the file got processed. Again, the watermarking details are remote. This is very helpful feature during development. Okay, so I want to just modify this existing application to actually transform this content. Basically, what do you think will be the payload of this mule message after file endpoint Do you think Getting the content of the whole file.
What if the file is 10 GB in size? Do you think the mule message payload after the file endpoint will be 10 gb the file says 10 gb No, actually what the payload after this file endpoint is a stream object basically, you can see that here payload is binary, it is a stream basically. So, the logger what is doing is just reading the stream and then converting it into binary send and it is writing it. Now what I want to do is I want to write a transformation Lang I want to use a transformer and convert it to a Java object and then log it. So, now I dragged and drop a transformer Want the file input stream to be converted to a Java object and I'll simply write payload. Let's see what it does.
Actually, after reading the CSV file, the payload will be a list. Now I want to iterate over the list, and then display each and every element of the list separately. So if we want to iterate over a list or an array, we can use something called for each scope. So right now I'll right click on the lager wrap in I will say, for each. Okay, so I have wrapped the logger for like four which is like a for loop. It loads element in the list or array.
And then for each element in the list, it'll execute the inner component. So again, let me stop it and run it. I click on this and say run as vacation lubrication. Yep, it is asking me to clear the application data. Yes, I'll clear it. So that the file will get reprocessed again I want to observe Yep, the application started and you can see the logger got executed multiple times in a loop and is logging each and every record separately is it?
So now you understand how I have looked using for each and how I have transformed the incoming stream from the file endpoint to a Java object list by writing a simple dw l Express Okay, so now you have a lab after this video, what you can do is you can just open the file, file module document, go to Step one, and complete up to step one, the lot of options which are discussed. Same thing, whatever I've shown you. Okay, so don't go to step two. I'll see you in next video.