Unable to delete files

Six Stars

Unable to delete files

Hello All,

I am trying to delete some json files after they are pushed into ActiveMQ in the below subjob but the files are not getting deleted.
Attached is the screenshot of the talend job please have a look.
Could you please guide me how to solve this.

Regards,
Yogesh.


Moderator

Re: Unable to delete files

Hello,

Did you want to delete json files from your local machine after they are pushed into ActiveMQ or from MQ server?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Unable to delete files

Hello @xdshi ,

I want to delete this files from local machine.

Moderator

Re: Unable to delete files

Hello,

Please make sure you tick on check box ("Delete File or Folder") in tFileDelete.

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Unable to delete files

Hello @xdshi ,
This configuration has been done then also it's not deleting the files

Community Manager

Re: Unable to delete files

Hi Kuwaryogi27
Do you use an existing connection on tMomOutput component? If so, you should use tMomCommit to commit the change and close the connection before deleting the file. eg:
tfileList_1--onsubjobok--tMomCommit--onsubjobok-->tFileList_2--iterate--tFileDelete.

Please try and let me know if it works.

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: Unable to delete files

Hello @shong ,

After doing the suggested changes still we are unable to delete the files.
Attached is the screenshot after modification.

Moderator

Re: Unable to delete files

Hello,

Please let us know your tfilelist_2 and tfiledelete component setting screenshots.

deletefile2.jfif

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Unable to delete files

Hello @xdshi ,
I have attached the screenshots please have a look.

Six Stars

Re: Unable to delete files

Hello @xdshi ,
If I check the Fail on error box then the job say's the file is being used you cannot delete the file.

Moderator

Re: Unable to delete files

Hello @kuwaryogi27 

Could you please try to do tfilelist-->tfiledelete in a child job and the main job calls the child job with option 'independent process' checked to see if it works?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Unable to delete files

Hello @xdshi ,
I tried the way suggested by you, but this option is still not working for me. 
Below are the screenshots of the modified job.
Please have a look.

Six Stars

Re: Unable to delete files

Hello All,
Please let me know if anyone has a solution over this topic.
Regards,
Yogesh.

Community Manager

Re: Unable to delete files

Hi kuwaryogi27
Are you sure there is no other applications or program are accessing the file at the same time. In this job, only tfileinputRaw component is reading the file, for testing, remove tMOMOutput component from the job to see if tfiledelete can delete the file in the end.

----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: Unable to delete files

Hello @shong ,

Apologies for the late reply.
I tried the same suggested by you it did not work.
Let me explain the complete scenario:
1] JSON files are created in this particular job by reading an excel.
2] Those JSON files are fetched by tFileOutputRaw -> .. -> tMomOutput
3] Need to delete those JSON files 

When the files are sent to tMomOutput the files are consumed by a JMS consumer in our application.

I have made a small configuration change in tFileDelete and selected the Fail on error checkbox.
It gave me the error that I have attached in the attachments, please have a look.

Quick questions:
1] So since the files are used by the JMS consumer is the reason to unable to delete those files.
2] I tried changing the directory from [C to D] because due to admin rights if it's not allowing to delete the files but this scenario also didn't worked.

Please guide me how can we achieve this task.

Thanks and Regards,
Yogesh.


Community Manager

Re: Unable to delete files

Hi Yogesh
"1] JSON files are created in this particular job by reading an excel."
I don't see where the json files are created in your job, maybe the problem occurs in this step, can you please show me the full screenshot of your job?

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: Unable to delete files

Hi Shong,


in tJava Component the logic to read an excel and convert a row into a json file has been written.
After tJava ->onSubJobOk ->tfilelist->tfileinputraw fetches the JSON files created in a folder on the local system and pushes them to a queue.

Regards,
Yogesh. 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now