---
title: "パイプラインバッチをプログラム的に開始する"
slug: "starting-a-pipeline-batch-programmatically"
abstract: "Data Exchange Frameworkのパイプラインをプログラム的にバッチ処理する例です。"
---
# パイプラインバッチをプログラム的に開始する

パイプラインのバッチはプログラム的に開始できます。例えば:

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
 }
 }
 }

> !注パイプラインバッチは内容によっては長時間実行されることがあります。パイプラインバッチが短時間で完了できると確信できない場合は、[Sitecoreタスク](https://doc.sitecore.com/xp/ja/developers/def/60/data-exchange-framework/scheduling-a-pipeline-batch.html "Scheduling a pipeline batch")で実行する方が良いかもしれません。