Developer forum

Forum » Integration » Delete & archive source files, and URL triggered integration jobs

Delete & archive source files, and URL triggered integration jobs

Arnór Halldórsson
Arnór Halldórsson
Reply

Hi,

I have a setup where I have a data integration job aimed at a specific directory, the integration job is triggered via URL whenever a file get´s written into the directory by a webservice running on my webserver. The integration job is set to Delete source file and Archive source files, however, when I receive a file, and the integration job starts, it will delete and archive that file, and all other files that have come into the directory after the integration job started. Shouldn´t the job only delete & archive the file that it read from?


Also, and maybe this belongs in the feature request section. Would it be possible, when you trigger an integration job via URL, to have it aim to a specific file in the URL? So let´s say I'm receiving files dynamicly with the naming convention PIMyyyyMMddhhssFFF.xml. Instead of the activation URL for the data integration job being:

http://testwebshop.is/admin/public/webservices/integrationv2/JobRunner.aspx?jobsToRun=PIM+CREATE&token=0b1b017713504bcefbeff143b3b666e

Could it be:

http://testwebshop.is/admin/public/webservices/integrationv2/JobRunner.aspx?jobsToRun=PIM+CREATE&targetFile=PIMyyyyMMddhhssFFF.xml&token=0b1b017713504bcefbeff143b3b666e

That way, each run of the data integration job would be targeted at a specific file, only that file would be deleted and archived after the import, and other simultaneous runs of the same integration job would only care for their respective files:)

 

Screenshots

1. The import activity mapping tables. Note that the files that are imported don´t always include all of those tables, but they never include tables that are not on this list:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2. The source settings:

3. The destination settings:

Best regards,
Arnór

 


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Arnór,

Shouldn´t the job only delete & archive the file that it read from? - No, it will delete all *.xml files from the source folder. If you want just one file to be deleted you need to set the XML provider to use "Source file" option. Then you can change your webserivce to rename the received file from PIMyyyyMMddhhssFFF.xml to some predefined source file that is used in the xml provider and then trigger the data integration job. If you want the content of several files to be imported you can concat them into one single xml file in your webservice code.

If you are using XML provider set to "Source folder" and want to keep some files in it then you need to rename the files extensions to be not the "*.xml" or ".xt".
Regards, Dmitrij

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Hi Dmitriy,

Ok but how about adding the functionality to specify the source file in the activation Url? That way each trigger of the data integration job would be targeted at a specific file and thus would only delete & archive that file.

Best regards,
Arnór

 
Nicolai Pedersen
Reply

Registered as TFS#51812.

BR Nicolai

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Arnór

The feature regarding #51812 "Xml file provider" has now been implemented in Dynamicweb version 9.4.15+

To upgrade please choose this version from here:

http://doc.dynamicweb.com/releases-and-downloads/releases

Let me know if you need any more help regarding this

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Hi Kristian,

Thank you very much :) 

I've tested it and mostly it works as intended. I put 3 xml files in a directory: 1st file containing 1 item for EcomGroup and EcomGroupRelations, 2nd file containing 1 item for EcomGroupProductRelation and the 3rd file containing 1 item for EcomGroupProductRelation but for a different product than the item in file 2. I ran the data integration job, it imported the EcomGroupRelations item from the 1st file but not the EcomGroup item, the EcomGroupProductRelation item from the 2nd file, and nothing from the 3rd file. Then all 3 files were archived but only the first 2 (the ones that data was imported from) were deleted, so the delete functionality is correct.

I have a few questions though:

  1. Could we fix the archive as well so only the affected files are archived?
  2. Do you have any ideas why the EcomGroup item was not imported from the 1st file? I'm guessing the reason for the EcomGroupProductRelation item in file 3 not beeing imported is because the job had already imported an item for that table in the file before.
    1. I can provide you with the data integration job as well as the XML files if you want to test in on your own :)
  3. Did you also implement the feature to target specific source files through the data integration job´s activation URL? Or was it only the delete file fix that was implemented now?

 

Best regards,
Arnór Geir

 
Nicolai Pedersen
Reply

Hi Arnór

We will look into this thread - and get back to you on Monday.

Thanks, Nicolai

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Awesome, thank you Nicolai :)

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Arnór,

1) Yes, will be fixed
2) Do you have the EcomGroups in the job mappings and it is marked as active? Also this can happen if you have any other xml file with blank EcomGroups section in the source folder so it was imported instead of the groups from your "first" xml file. I need your source folder with your input files and your job xml file with mappings to get it reproduced. Send them to dbe@dynamicweb-cms.com
The reason for the EcomGroupProductRelation item in file 3 not beeing imported is because the job had already imported an item for that table in the file before - correct

3) Yes, you can use it following that syntax in your url: &SourceFile=new test file.xml
So your ULR may look like that:
http://dw9.local.dynamicweb.dk/admin/public/webservices/integrationv2/JobRunner.aspx?jobsToRun=multiple+fiels+delete&token=b0e070dcd5c43e19ccce1f6c91f3865b&SourceFile=new test file.xml
Regards, Dmitrij

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Arnór,
Regarding "2": there is a restriction when you are using folder as a source and several xml files: only one table must be used per one xml file, so when you have one xml file
with  EcomGroups and EcomGroupRelations tables the first processed is EcomGroupRelations so next tables present in this file gets skipped and EcomGroups are not imported. Also I've seen that you have several EcomGroupRelations tables in the mapping but this is not recommended, you shouldn't have the repeating/duplicate mappings.
Regards, Dmitrij

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Hi Dmitriy,

I was just about to reply to you. When I use that &SourceFile= parameter in the activation URL, the problem in case 2. seems to go away :)

But so I address the XML weirdness over multiple files. The reason for that is that the PIM system that our client uses is sending us the data in deltas for each change made in the system, i.e. they send us XML for each save event per product. So when our client drags 5 products into one group in the PIM, the PIM sends us 5 XMLs, 1 for each connection between the product and the group. The people servicing the PIM system have laid in a lot of work for us to merge the XML as much as possible before sending it to us, though in some cases they are not able to merge it due to the infrastructure of the system. But as I said, with the implementation of the &SourceFile= parameter in the activation URL, this problem seems to go away anyway :)

This is a major quality of life improvement for us so thank you very much for this feature!!

Best regards,
Arnór Geir

 

You must be logged in to post in the forum