Starting a pipeline batch programmatically

Version: 8.0

You can start pipeline batches programmatically. For example:

RequestResponse
Guid tenantId = ... //identify the tenant that owns the pipeline batch
Guid pipelineBatchId = ... //identity the pipeline batch
IEnumerable<PipelineBatch> batches = null;
tasks = Sitecore.DataExchange.Context.PipelineBatchRepository.GetPipelineBatches(tenantId);
if (batches != null)
    {
        PipelineBatch pipelineBatch = batches.FirstOrDefault(x => x.ID == pipelineBatchId);
        if (pipelineBatch != null)
            {
                var runner = new InProcessPipelineBatchRunner();
                if (runner.Run(pipelineBatch))
                    {
                        //pipeline batch was started
                    }
            }
    }
Note

A pipeline batch can run for a long time, depending on its content. Unless you are certain that the pipeline batch can finish in a short amount of time, you might prefer to run it in a Sitecore task.

Do you have some feedback for us?

If you have suggestions for improving this article,