39562: Pitfalls With The Copy/Move Files Action Task

Translate to:

Applies to:

Summary:

This article describes common pitfalls that users may encounter with the new Copy/Move Files action task introduced with MassTransit 5.1.

Description:

MassTransit 5.1 introduces a new action task that allows MassTransit to move or copy files to another location after certain events occur. This powerful feature can have unexpected side effects if improperly configured.

No Files Available

One possible problem with the Copy/Move Files action task is that when an event happens no files are copied or moved. This usually occurs because the event that the task is configured to trigger on does not have any files associated with it. For example, there are never any files associated with the "Contact Added" event, so a Copy/Move Files action task will have nothing to do if it is configured to fire on this event. The list below shows the MassTransit events that may have files associated with them:

  • After Files Are Added
  • After Files Are Sent
  • After Files Are Received
  • Before A File Is Processed
  • After A File Is Processed
  • Output Processing Fails (May or may not have file associated with the event depending on what the error is and when it occurred)
  • Before File Entries Are Deleted
  • After Each File Is Sent
  • After Each File Is Received
  • Before Files Are Transmitted

File Transfer Fails (May or may not have file associated with the event depending on what the error is and when it occurred.)
If you configure this type of task to run for other MassTransit triggers, no files will be moved or copied.

Broken Workflows

Another common problem with the Copy/Move Files action occurs where its use causes a workflow to break. Usually the cause of the problem is that the action task has been used to move files to a different folder and that MassTransit or some other component of the workflow can no longer find these files.

For example, consider the situation where you have a Copy/Move Files action task configured to trigger "after files are added" and to move the files to a folder at /tmp/a_folder. When files are then added to MassTransit the action will fire and move all of the added files to /tmp/a_folder. When MassTransit later connects to send the added files it will not be able to find them because they have been moved and will therefore generate a "File Not Found" error for each missing file. Similar problems can occur in workflows that use forwarding or services if move actions are configured to trigger "after files are received".

In general, it is safest to use the copy files action task to avoid moving files that are needed by later steps in the workflow. Please assess your workflow carefully before using the move files action task to avoid errors. 

Tags: 

You are reporting a typo in the following text:
Simply click the "Send typo report" button to complete the report. You can also include a comment.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
3 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.