---
schema_version: "1"
id: 63d3f45b9cc72c5a0d2dda0339eaa8a246966b656975ee75243a5a69dc60449a
title: Anypoint Code Builder を使用したコネクタの設定
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/connectors/introduction/intro-config-use-acb.md
canonical_url: https://docs.mulesoft.com/jp/connectors/introduction/intro-config-use-acb
source_site: docs.mulesoft.com
content_type: documentation
content_hash: f84ea1742c0682650e513baf312bbfa0308058e87878bc6f2f5ab724b4656d71
description: MuleSoft Documentation Site
latest: true
---
# Anypoint Code Builder を使用したコネクタの設定

Anypoint Code Builder を使用してコネクタを設定する手順は、次のとおりです。

- Anypoint Code Builder で​[基本インテグレーションプロジェクトを作成します](#create-integration-project)​。
- ビジネスロジックを処理する Mule アプリケーションに​[コネクタを追加](#add-connector-to-project)​し、他のコンポーネントも追加します。
- [コネクタのトリガーを設定します](#configure-trigger)​。
- [コネクタの操作を設定します](#configure-component-attributes)​。

## [](#before-you-begin)始める前に

インテグレーションプロジェクトを作成する前に、次の作業を行う必要があります。

- [Anypoint Code Builder の Web またはデスクトップ IDE をセットアップしてアクセスします。](https://docs.mulesoft.com/jp/anypoint-code-builder/start-acb)
- コネクタの API にアクセスするためのログイン情報を用意します。

コネクタを使用するには、以下に精通している必要があります。

- コネクタの API
- Anypoint Connector
- Mule Runtime Engine (Mule)

前提条件を満たしたら、Anypoint Code Builder でアプリケーションを作成してコネクタを設定できます。

## [](#create-integration-project)新しいインテグレーションプロジェクトを作成する

Unresolved include directive in modules/ROOT/pages/introduction/intro-config-use-acb.adoc - include::connectors::partial$acb-reusable-steps-for-connector-config.adoc\[\] . **\[Quick Actions (クイックアクション)\]**​ から ​**\[Develop an Integration (インテグレーションを開発)\]**​ をクリックします。

\+ !["\[Getting started (使用開始)](/mulesoft/current/ja-jp/anypoint-code-builder/_images/develop-integration-option-mat.png) セクション内で強調表示されている \[Develop an Integration (インテグレーションを開発)\]リンク"\] . **\[Develop an Integration (インテグレーションを開発)\]**​ フォームに入力します。

+

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">属性</th>
<th class="tableblock halign-left valign-top">値</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><strong>Project Name (プロジェクト名)</strong></p>
</div></div></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>プロジェクトの一意の名前。</p>
</div>
<div class="paragraph">
<p>この名前はタイトルおよびインテグレーションプロジェクトファイルの名前として使用されます。
たとえば、プロジェクト名が「Salesforce Integration」 (Salesforce インテグレーション) の場合、プロジェクトファイル名は ​<code>salesforce-integration</code>​ になります。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><strong>Project Location (プロジェクトの場所)</strong></p>
</div></div></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>ホームディレクトリまたは作成する別のディレクトリ。インテグレーションプロジェクト用の別のディレクトリを選択するには、​<strong>[Browse (参照)]</strong>​ をクリックします。</p>
</div>
<div class="paragraph">
<p>別のプロジェクトディレクトリ内にプロジェクトを作成しないでください。</p>
</div>
<div class="paragraph">
<p><a href="https://docs.mulesoft.com/jp/anypoint-code-builder/start-add-folders" class="xref page">ホームディレクトリへのフォルダーの追加</a>を参照してください。</p>
</div></div></td>
</tr>
</tbody>
</table>

1. **\[Create Project (プロジェクトを作成)\]**​ をクリックします。

## [](#add-connector-to-project)インテグレーションプロジェクトにコネクタを追加する

Anypoint Connector では、システムからのデータの取得、データの変更、システムへのデータの送信を行うための操作が提供されます。

Anypoint Code Builder で提供される​[組み込みコネクタ](https://docs.mulesoft.com/jp/anypoint-code-builder/acb-reference#builtin-connectors)​に加えて、ユーザーは Anypoint Exchange から他の多くのコネクタをダウンロードできます。

Exchange からコネクタをインポートして設定に追加する手順は、次のとおりです。

1. \[Explorer\] ビューで、目的のプロジェクトの設定 XML ファイル (​`my-project-name.xml`​ など) を開きます。
2. キャンバス UI が自動的に開かない場合は、アクティビティバーの ​![Show Mule graphical mode (Mule グラフィカルモードを表示)](/mulesoft/current/ja-jp/anypoint-code-builder/_images/icon-tree-view.png)​ (​**Show Mule graphical mode (Mule グラフィカルモードを表示)**​) アイコンをクリックしてキャンバス UI を開きます。
3. キャンバス UI から他のコンポーネントを追加した方法と同じ方法でコネクタを追加します。
    
    1. キャンバス UI で ​!["\[Add component (コンポーネントを追加)](/mulesoft/current/ja-jp/anypoint-code-builder/_images/icon-plus.png) アイコン",15,15\]​ (​**\[Add component (コンポーネントを追加)\]**​) アイコンをクリックします。
    2. **\[Add Component (コンポーネントを追加)\]**​ パネルで ​**\[Connectors (コネクタ)\]**​ をクリックします。
    3. コネクタ名をクリックし、追加する操作 (​**Publish**​ など) をクリックします。
        
        !["Anypoint MQ Connector での \[Add Publish](/mulesoft/current/ja-jp/anypoint-code-builder/_images/int-add-connector-operation.png) 操作"\]
        
        コネクタをローカルで使用できない場合、​!["\[Search in Exchange (Exchange 内を検索)](/mulesoft/current/ja-jp/anypoint-code-builder/_images/icon-search-exchange.png) アイコン",15,15\]​ (​**\[Search in Exchange (Exchange 内を検索)\]**​) 切り替えをクリックします。
        
        !["\[Search in Exchange (Exchange 内を検索)](/mulesoft/current/ja-jp/anypoint-code-builder/_images/int-connector-search-exchange.png) 切り替え"\]
        
        <table><tbody><tr><td><i class="conum" data-value="1"></i><b>1</b></td><td>Search locally (ローカルで検索)</td></tr><tr><td><i class="conum" data-value="2"></i><b>2</b></td><td>Search in Exchange (Exchange 内を検索)</td></tr></tbody></table>
    4. プロジェクトに追加するコネクタを選択します。
    5. **\[Add Component (コンポーネントを追加)\]**​ パネルから操作を選択します。

コネクタをインテグレーションプロジェクトに追加しても、Anypoint Code Builder ワークスペースの他のプロジェクトはそのコネクタを使用できません。

## [](#creating-config-file)設定ファイルの作成

設定ファイルは、別の設定を参照したり、コネクタのプロパティの値を指定したりする YAML ファイルです。アプリケーションをデプロイする環境に基づいて設定プロパティを定義します。

1. **\[Explorer\]**​ ビューで ​**resources**​ フォルダー (​`src/main/resources`​) を右クリックして ​**\[New File (新規ファイル)\]**​ を選択します。
2. ファイルに ​`config.yaml`​ という名前を付けます。
3. コネクタに接続するために必要な接続プロパティをファイルに入力します。Salesforce、Gmail、Slack の接続プロパティの例を次に示します。
    
    ```YAML
    salesforce:
     username: "yourUserName"
     password: "yourPassword"
     token: "yourToken"
    
    email:
     host: "smtp.gmail.com"
     username: "yourGmailEmail"
     password: "yourEmailAppPassword"
    
    slack:
     token: "yourSlackToken"
    ```
4. プロジェクト XML に移動し、​`</mule>`​ タグの前に新しい行を追加し、​`「configuration」`​と入力して ​**mule:configurationProperties**​ を選択します。
    
    ![矢印で mule:configurationProperties コンポーネントを指し示しているコンポーネントのリスト](/mulesoft/current/ja-jp/anypoint-code-builder/_images/select-mule-config-properties-contacts-sync.png)
5. 属性をスクロールして、​`file`​ の値を ​`config.yaml`​ に設定します。
    
    ```XML
    <configuration-properties file="config.yaml" doc:name="Configuration properties" />
    ```

### [](#salesforce-connector-の設定例)Salesforce Connector の設定例

`config.yaml`​ ファイルの値を使用して、Salesforce Connector を Salesforce 環境に接続します。

1. プロジェクト XML ファイルで、​`<configuration-properties/>`​ 要素の後に新しい行を作成し、​`「salesforce」`​と入力して ​**salesforce:sfdc-config**​ を選択します。
2. **\[name (名前)\]**​ 項目を ​`[Salesforce-Config]`​ に設定します。
3. 新しい行を作成し、​`「basic」`​と入力して ​**Salesforce。Basic**​ を選択します。
4. 設定ファイル値を使用するように ​`username`​ および ​`password`​ プロパティを設定します。
    
    ```XML
    <salesforce:basic-connection username="${salesforce.username}" password="${salesforce.password}" securityToken="${salesforce.token}" />
    ```
    
    <table>
<tbody><tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p><code>${salesforce.username}</code>​ および ​<code>${salesforce.password}</code>​ 要素の上にカーソルを置くと、Anypoint Code Builder に設定ファイルの値が表示されます。</p>
</div>
</td>
</tr>
</tbody></table>
5. `<salesforce:sfdc-config/>`​ 要素の ​**\[Test Connection (接続をテスト)\]**​ をクリックして、Salesforce への接続を検証します。
    
    ![接続 XML の \[Test Connection (接続をテスト)\] オプションを指し示している矢印](../../anypoint-code-builder/_images/sync-api-sfdc-test-connection.png)
    
    Anypoint Code Builder で ​**\[Connection is valid (接続は有効)\]**​ メッセージが返されます。
    
    エラーを取得した場合、エラーメッセージを確認してさらにトラブルシューティングします。詳細は、​[「トラブルシューティング」](https://docs.mulesoft.com/jp/anypoint-code-builder/troubleshooting)​を参照してください。

## [](#configure-trigger)フローのトリガーの設定

トリガー (ソース) は、指定された条件が満たされたときにフローを開始します。コネクタに独自のソースが関連付けられている場合、コネクタ固有のトリガーを使用してフローを開始できます。各コネクタトリガーには、固有の設定があります。

### [](#http-リスナーの設定)HTTP リスナーの設定

HTTP リスナーをフローのトリガーとして使用する手順は、次のとおりです。

1. キャンバスで ​**\[Listener\]**​ コンポーネントをクリックします。
2. (省略可能) 編集アイコンをクリックして、​**\[Listener\]**​ コンポーネントの名前を変更します。
3. (省略可能) コネクタの設定ファイルを作成した場合はそれを選択します。
4. **\[General (一般)\]**​ タブの ​**\[Path (パス)\]**​ 項目に、HTTP 設定要素で設定されたパスの相対パスを入力します。​[「パスの設定」](https://docs.mulesoft.com/http-connector/latest/http-listener-ref#configure-paths)​を参照してください。
5. **\[Advanced (詳細)\]**​ タブを選択して、次の属性を設定します。
    
    <table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">属性</th>
<th class="tableblock halign-left valign-top">説明</th>
<th class="tableblock halign-left valign-top">必須</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Allowed methods (許可されるメソッド)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">すべての HTTP メソッドを許可する (デフォルト) 場合は、この属性を定義しないでください。特定のメソッドを制限するには、許可される HTTP メソッドをカンマ区切り形式で指定します (例: <code>POST,GET</code>​)。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Response streaming mode (応答ストリーミングモード)</p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>応答の送信時にストリーミングを使用するかどうか。HTTP Connector は、レスポンスボディの管理時に本文のサイズが明らかではない場合、送信するデータの種類を考慮し、​<em>chunked</em>​ エンコードを使用します。これによりサイズ情報のないストリームとなります。この動作を制御するには、次のいずれかのオプションを選択します。</p>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>AUTO (デフォルト)</strong>​<br>
本文のサイズが定義されている場合、​<code>Content-Length</code>​ エンコードを使用します。定義されていない場合は ​<code>Transfer-Encoding: chunked</code>​ を使用します。</p>
</li>
<li>
<p><strong>ALWAYS (常時)</strong>​<br>
存在するサイズデータに関係なく ​<code>Transfer-Encoding: chunked</code>​ を使用します。</p>
</li>
<li>
<p><strong>NEVER (なし)</strong>​<br>
<code>Content-Length</code>​ エンコードを使用し、必要に応じてストリームをコンシュームしてデータサイズを判定します。</p>
</li>
</ul>
</div></div></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Output MIME type (出力 MIME タイプ)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">このコンポーネントで出力されるペイロードの MIME タイプ。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">パラメーター</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">リーダープロパティのキー-値ペアが出力 MIME 属性に追加されます。複数のキーと値のペアが許可されます。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Output encoding (出力エンコード)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">このコンポーネントで出力されるペイロードのエンコード。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Streaming Strategy (ストリーミング戦略)</p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="ulist">
<ul>
<li>
<p><a href="https://docs.mulesoft.com/http-connector/latest/http-documentation#repeatable-in-memory-stream" class="xref page">Repeatable in-memory stream (反復可能なメモリ内ストリーム)</a></p>
</li>
<li>
<p><a href="https://docs.mulesoft.com/http-connector/latest/http-documentation#repeatable-file-store-stream" class="xref page">Repeatable file store stream (反復可能なファイルストアストリーム)</a></p>
</li>
<li>
<p>Non-repeatable stream</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>ストリーミング戦略の設定についての詳細は、​<a href="#configuring-streaming-strategy">XML でのストリーミング戦略の設定</a>​を参照してください。</p>
</div></div></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Primary node only (プライマリノードのみ)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">選択すると、アプリケーションがクラスターで実行されるときに ​<strong>Listener</strong>​ トリガーがプライマリノード上でのみ実行されます。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Redelivery policy (再配信ポリシー)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">エラーを生成する要求を実行するための再配信ポリシーを設定します。再配信ポリシーは、フロー内のあらゆる提供元に追加できます。再配信ポリシーの設定についての詳細は、​<a href="https://docs.mulesoft.com/http-connector/latest/http-documentation#RedeliveryPolicy" class="xref page">「再配信ポリシー」</a>​を参照してください。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Reconnection strategy (再接続戦略)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Mule アプリケーション内の操作が外部サーバーへの接続に失敗すると、デフォルト動作ではその操作は直ちに失敗し、接続エラーが返されます。デフォルト動作を変更するには、操作の再接続戦略を設定します。​<a href="https://docs.mulesoft.com/http-connector/latest/http-documentation#reconnect" class="xref page">「Reconnect (再接続)」</a>​、​<a href="https://docs.mulesoft.com/http-connector/latest/http-documentation#reconnect" class="xref page">「Reconnect Forever (繰り返し再接続)」</a>​、および​<a href="#configuring-reconnection-strategy">XML での再接続戦略の設定</a>​を参照してください。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Response (応答)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">メッセージの本文 (またはペイロード) に関連付けられたメタデータが含まれる属性。詳細は、​<a href="https://docs.mulesoft.com/http-connector/latest/http-documentation#HttpResponseAttributes" class="xref page">「HTTP Response Attributes (HTTP 応答属性)」</a>​を参照してください。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Error Response (エラー応答)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">選択すると、HTTP エラー応答でエラーの状況コードが返されます。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Body (本文)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">エラーメッセージの本文。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Headers (ヘッダー)</p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>エラーメッセージに含めるヘッダー。各ヘッダー属性は、等号 (=) で区切られたキー-値のペアになっています。次に例を示します。</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-text hljs" data-lang="text">Headers=[
      date=Sun, 20 Jan 2019 19:13:51 GMT
      content-type=text/html;
      charset=UTF-8
      transfer-encoding=chunked
      connection=keep-alive
      set-cookie=__cfduid=d03462713a0b2c57c8d2ad3bf311287041548011631;
      expires=Mon, 20-Jan-20 19:13:51 GMT;
      path=/;
      domain=.typicode.com;
      HttpOnly
      x-powered-by=Express
      vary=Origin, Accept-Encoding
      access-control-allow-credentials=true
      cache-control=public, max-age=14400
      last-modified=Tue, 15 Jan 2019 18:17:15 GMT
      via=1.1 vegur
      cf-cache-status=HIT
      expires=Sun, 20 Jan 2019 23:13:51 GMT
      expect-ct=max-age=604800,
      report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
      server=cloudflare
      cf-ray=49c3dc570c2f281c-SJC
   ]</code></pre>
</div>
</div></div></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Status code (状況コード)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">エラー応答の状況コード (​<code>Status Code (状況コード) = 500</code>​ など)。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">理由を示す語句</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">エラーの理由 (​<code>[Gateway Timeout (ゲートウェイがタイムアウトしました)]</code>​ や ​<code>Internal Server Error (内部サーバーエラー)</code>​ など)。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
</tbody>
</table>

リスナー設定属性についての詳細は、​[「リスナー設定」](https://docs.mulesoft.com/http-connector/latest/http-documentation#listenerConfig)​を参照してください。

### [](#use-scheduler-trigger)スケジューラーの設定

Scheduler により、固定の頻度、または Cron 式に基づいた間隔でスケジュール戦略が設定されます。

Mule アプリケーションに Scheduler を追加するときは、次の点を考慮してください。

- Scheduler は、Mule が動作しているマシンと同じタイムゾーンを使用します。ただし、アプリケーションが CloudHub で動作している場合は、アプリケーションが動作している地理的リージョンに関係なく、Scheduler は UTC タイムゾーンに準拠します。
    
    Scheduler に別のタイムゾーンを設定するには、​[Cron スケジュール戦略属性](#cron-attributes)​の ​`timeZone`​ を参照してください。
- `disallowConcurrentExecution`​ プロパティを使用すると、以前にトリガーされた実行の処理中に Scheduler でフローの実行がトリガーできないようにできます。
- スケジュールされたトリガー時に利用できるリソースが 1 つもないために ​[back-pressure](https://docs.mulesoft.com/mule-runtime/latest/execution-engine#backpressure)​ が発生した場合、その実行はスキップされます。
- Mule Runtime Engine クラスターやマルチワーカー CloudHub デプロイメントでは、Scheduler はプライマリノードのみで (つまり 1 つの Mule インスタンスのみで) 実行されます。

```xml
<scheduler doc:name="Scheduler" doc:id="snswxf" >
  <scheduling-strategy/>
</scheduler>
```

Scheduler (​`<scheduler/>`​) 属性は UI および XML で設定できます。

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 60%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">属性名</th>
<th class="tableblock halign-left valign-top">属性 XML</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Scheduler (スケジューラー)</strong>​ (デフォルト)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>doc:name</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>キャンバスに表示されるコンポーネントの編集可能な名前。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">なし</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>doc:id</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>コンポーネントの自動生成された識別子。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Disallow concurrent execution (同時実行を禁止)</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>disallowConcurrentExecution</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>この属性を ​<code>true</code>​ に設定すると、Scheduler は前の実行がまだ処理中であればスケジュールされた実行をスキップします。フローが完了すると、Scheduler は次に設定された間隔で実行されます。デフォルト値は ​<code>false</code>​ です。</p>
</div></div></td>
</tr>
</tbody>
</table>

### [](#fixed-frequency-attributes)一定間隔属性

Scheduler では、次の属性を受け入れる一定間隔 (​`<fixed-frequency/>`​) 要素を受け入れます。

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 60%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">属性名</th>
<th class="tableblock halign-left valign-top">属性 XML</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">なし</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>frequency</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>指定された ​<code>timeUnit</code>​ 設定で Scheduler がフローをトリガーする頻度。デフォルトは ​<code>1000</code>​ です。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">なし</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>startDelay</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>アプリケーションが起動した後で Scheduler の最初の実行を遅延する時間。このプロパティでは頻度と同じ ​<code>timeUnit</code>​ を使用します。デフォルトは ​<code>0</code>​ です。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">なし</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timeUnit</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><code>frequency</code>​ と ​<code>startDelay</code>​ の値の次のいずれかの時間単位: <code>MILLISECONDS (ミリ秒)</code>​、​<code>SECONDS (秒)</code>​、​<code>MINUTES (分)</code>​、​<code>HOURS (時)</code>​、または ​<code>DAYS (日)</code>​。デフォルトは ​<code>MILLISECONDS (ミリ秒)</code>​ です。</p>
</div></div></td>
</tr>
</tbody>
</table>

[一定間隔の例](#example1)​を参照してください。

### [](#cron-attributes)Cron 属性

より複雑なスケジューリングの場合、​`<cron/>`​ 要素で Cron 式を設定します。

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 60%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">属性名</th>
<th class="tableblock halign-left valign-top">属性 XML</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">なし</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>expression</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>Scheduler をトリガーする Cron 式。デフォルトの Cron 式はありません。式の詳細は、​<a href="#cron-expressions">Cron 式</a>​を参照してください。例: <code>expression="1 1 1 1,7 * ?"</code>​。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">なし</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timeZone</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>システムプロパティとして渡されるタイムゾーン、またはマシンのオペレーティングシステムで設定されているタイムゾーン。  <a href="https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html" target="_blank" rel="noopener">Java のタイムゾーン</a>​の値がサポートされます。Java の短縮表記 (​<code>PST</code>​ や ​<code>AGT</code>​) は使用せず、Java の完全表記 (​<code>America/Los_Angeles</code>​ など) を使用してください。例: <code>timeZone="America/Argentina/Buenos_Aires"</code>​。</p>
</div></div></td>
</tr>
</tbody>
</table>

[Cron の例](#example2)​を参照してください。

### [](#example1)一定間隔の例

次の例では、Scheduler は 15 秒ごとに実行されます。

```xml
<flow name="ex-fixed-frequency-flow" >
  <scheduler doc:name="Scheduler">
    <scheduling-strategy>
      <fixed-frequency frequency="15" timeUnit="SECONDS" />
    </scheduling-strategy>
  </scheduler>
  <!-- One or more processors here. -->
</flow>
```

次の例では、Scheduler はフローが完了までに要する時間が固定の頻度である 10 ミリ秒を超えると実行をスキップします。

```xml
<flow name="scheduler-disallowConcurrentExecution-ex" >
  <scheduler doc:name="Scheduler" disallowConcurrentExecution="true" >
    <scheduling-strategy>
      <fixed-frequency frequency="10" timeUnit="MILLISECONDS"/>
    </scheduling-strategy>
  </scheduler>
  <!-- processors here -->
</flow>
```

Scheduler が実行をスキップするたびに、たとえば次のような ​`Execution skipped`​ メッセージがログに記録されます (読みやすいように編集済み)。

```logs
INFO  2022-11-09 15:15:43,082 ...
...scheduler.DefaultSchedulerMessageSource:
Flow 'scheduler-disallowConcurrentExecution-ex' is already running and
'disallowConcurrentExecution' is set to 'true'. Execution skipped.

INFO  2022-11-09 15:15:43,083 ...
...scheduler.DefaultSchedulerMessageSource:
Flow 'scheduler-disallowConcurrentExecution-ex' is already running and
'disallowConcurrentExecution' is set to 'true'. Execution skipped.
```

次の例は、最初の 10 秒の遅延後、10 秒ごとに Scheduler を実行する一定間隔のスケジュール戦略を示しています。

```xml
<scheduler doc:name="Scheduler" >
  <scheduling-strategy >
    <fixed-frequency frequency="10" timeUnit="SECONDS" startDelay="10"/>
  </scheduling-strategy>
</scheduler>
```

### [](#example2)Cron の例

次の例では、15 秒ごとにフローが新たに実行され、Mule メッセージの生成がトリガーされる Cron 式を使用します。

```xml
<flow name="ex-cron-expression-flow" >
  <scheduler doc:name="Scheduler" >
    <scheduling-strategy >
      <cron expression='0/15 * * * * ? '/>
    </scheduling-strategy>
  </scheduler>
  <!-- One or more processors here. -->
</flow>
```

次の例では、​`America/Los_Angeles`​ タイムゾーンで毎日 12 時 00 分にフローをトリガーする Cron 式を使用します。

```xml
<flow name="componentsFlow">
  <scheduler>
    <scheduling-strategy>
      <cron expression="0 0 12 * * ?" timeZone="America/Los_Angeles"/>
    </scheduling-strategy>
  </scheduler>
  <logger message="my message"/>
</flow>
```

## [](#cron-expressions)Cron 式

Cron は、日時情報を記述するのに広く利用されている標準です。Cron 式 (​`<cron expression />`​ スケジュール戦略 (​`<scheduling-strategy >`​) は、固定頻度スケジュール戦略では不可能な間隔でフローをトリガーする場合に便利です。

Scheduler は、毎秒を監視し、Quartz Cron 式が日時の設定と一致すると Mule イベントを作成します。イベントは 1 回だけ、または一定間隔でトリガーできます。

日時の式は、6 つの必須設定と、年の設定 (省略可能) で構成されます。設定は以下の順序で指定します。

1. 秒 (​`0`​-​`59`​)
2. 分 (​`0`​-​`59`​)
3. 時 (​`0`​-​`23`​)
4. 日 (​`1`​-​`31`​)
5. 月 (​`1`​-​`12`​ または ​`JAN`​-​`DEC`​)
6. 曜日 (​`1`​-​`7`​ or ​`SUN`​-​`SAT`​)
7. 年 (空白、または ​`1970`​-​`2099`​ の範囲内の 4 桁。例: `2019`​)

Scheduler は Quartz Cron 式をサポートします。例をいくつか示します。

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">式</th>
<th class="tableblock halign-left valign-top">動作</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>1/2 * * * * ?</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">毎日 2 秒おきに実行。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>0 15 10 ? * *</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">毎日午前 10 時 15 分に実行。  <code>0 15 10 * * ? <strong></strong></code><strong>​</strong>` と <code>​0 15 10 *​`0 15 10 * * ?</code>​ は同じ結果になります。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>0 15 10 * * ? 2019</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">2019 年の毎日午前 10 時 15 分に実行。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>0 * 14 * * ?</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">毎日午後 2 時から 2 時 59 分まで、毎分実行。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>0 0/5 14 * * ?</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">毎日午後 2 時から 2 時 55 分まで、5 分おきに実行。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>1 1 1 1,7 * ?</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">毎月 1 日と 7 日の午前 1 時 1 分 1 秒に実行。</p></td>
</tr>
</tbody>
</table>

Scheduler コンポーネントは、Quartz Scheduler の特殊文字もサポートします。

- `*`​: すべての値。
- `?`​: 任意の 1 つの値。
- `-`​: 値の範囲。例: `1-3`​。
- `,`​: 追加の値。例: `1,7`​。
- `/`​: 増分値。例: `1/7`​。
- `L`​: 週または月の最終日、または月の最後の特定の曜日 (例: `6L`​ は月の最後の土曜日)。
- `W`​: 平日。月または曜日の項目で有効。
- `#`​: 月の "n" 日目。例: `#3`​ は月の 3 日。

次の例は、「hello」というメッセージを毎秒ログに記録します。

```XML
<flow name="cronFlow" >
  <scheduler doc:name="Scheduler" >
    <scheduling-strategy >
      <cron expression="* * * * * ?" />
    </scheduling-strategy>
  </scheduler>
  <logger level="INFO" doc:name="Logger" message='"hello"'/>
</flow>
```

Cron 式をビルドするための無料のオンラインツールがたくさんあります。

### [](#using-connector-specific-trigger)コネクタ固有のトリガーの使用

コネクタにトリガーが関連付けられている場合、コネクタ固有のトリガーを使用してフローを開始できます。各コネクタトリガーには、固有の設定があります。

たとえば、次のトリガーのいずれかを Salesforce Connector で使用するように設定できます。

- **On Deleted Object**
    
    Salesforce ユーザーがオブジェクトを削除した時点でアプリケーションを開始します。​`Contact`​、​`Lead`​、​`Account`​、​`Contracts`​、​`Opportunity`​ のオブジェクト種別、またはカスタムオブジェクト名を指定できます。
- **On Modified Object**
    
    Salesforce ユーザーがオブジェクトを変更した時点でアプリケーションを開始します。​`Contact`​、​`Lead`​、​`Account`​、​`Contracts`​、​`Opportunity`​ のオブジェクト種別、またはカスタムオブジェクト名を指定できます。
- **On New Object**
    
    Salesforce ユーザーがオブジェクトを作成した時点でアプリケーションを開始します。​`Contact`​、​`Lead`​、​`Account`​、​`Contracts`​、​`Opportunity`​ のオブジェクト種別、またはカスタムオブジェクト名を指定できます。
- **Replay channel listener**
    
    ストリーミングチャネルをサブスクライブします。このソースでは、24 時間の保持期間内の新規イベントおよび Salesforce で保存されたイベントについてチャネル関連の通知設定が提供されます。指定されたチャネルソースでイベントが発生するとフローがトリガーされます。
- **Replay topic listener**
    
    トピックをサブスクライブします。このソースでは、24 時間の保持期間内の新規イベントおよび Salesforce で保存されたイベントについてトピック関連の通知設定が提供されます。レコードの指定されたトピックでイベントが発生するとフローがトリガーされます。
- **Subscribe channel listener**
    
    ストリーミングチャネルをサブスクライブします。このソースでは、サブスクライブ後に発生した新規イベントについてチャネル関連の通知設定が提供されます。
- **Subscribe topic listener**
    
    トピックをサブスクライブします。このソースでは、サブスクライブ後に発生した新規イベントについてトピック関連の通知設定が提供されます。

<table><tbody><tr><td class="icon"><i class="fa icon-note" title="Note"></i></td><td class="content">チャネルのサブスクリプションを作成する前に、チャネルまたはトピックを Salesforce にパブリッシュする必要があります。</td></tr></tbody></table>

たとえば、​**On New Object**​ ソースを設定する手順は、次のとおりです。

1. **\[On New Object\]**​ コンポーネントをキャンバスに追加します。
2. キャンバスで ​**\[On New Object\]**​ コンポーネントをクリックします。
3. **\[General (一般)\]**​ タブで、使用する設定ファイルを選択し、次の属性を設定します。
    
    <table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">属性</th>
<th class="tableblock halign-left valign-top">説明</th>
<th class="tableblock halign-left valign-top">必須</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Object type (オブジェクト種別)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Salesforce オブジェクトの種別。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">はい</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Triggers query (トリガーのクエリ)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">トリガー結果を絞り込むクエリ (例: <code>Name='Filter'</code>​)。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Since (以降)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>YYYY-MM-DD hh:mm:ss</code>​ 形式の日付 (例: <code>2017-03-17 16:30:40</code>​)。この項目が空の場合、このソースは選択されたオブジェクトを Mule アプリケーションが開始した時刻から取得します。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Scheduling strategy (スケジュール戦略)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">時間ベースの条件に基づいてフローの実行をトリガーします。​<a href="#use-scheduler-trigger">スケジューラーの設定</a>​ を参照してください。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">はい</p></td>
</tr>
</tbody>
</table>
4. **\[Advanced (詳細)\]**​ タブを選択して、次の属性を設定します。
    
    <table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">属性</th>
<th class="tableblock halign-left valign-top">説明</th>
<th class="tableblock halign-left valign-top">必須</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Primary node only (プライマリノードのみ)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">選択すると、アプリケーションがクラスターで実行されるときに ​<strong>On New Object</strong>​ トリガーがプライマリノード上でのみ実行されます。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Redelivery policy (再配信ポリシー)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">詳細は、​<a href="#salesforce/salesforce-connector-reference.adoc#RedeliveryPolicy" class="xref unresolved">「再配信ポリシー」</a>​を参照してください</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Read timeout (読み取りタイムアウト)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">コンシューマーがタイムアウトする前に応答を待機する時間。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Time unit (時間単位)</p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><strong>[Read timeout (読み取りタイムアウト)]</strong>​ 属性の時間単位。Enumeration (列挙)。次のいずれかになります。</p>
</div>
<div class="ulist">
<ul>
<li>
<p>NANOSECONDS</p>
</li>
<li>
<p>MICROSECONDS</p>
</li>
<li>
<p>MILLISECONDS</p>
</li>
<li>
<p>SECONDS</p>
</li>
<li>
<p>MINUTES</p>
</li>
<li>
<p>HOURS</p>
</li>
<li>
<p>DAYS</p>
</li>
</ul>
</div></div></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Reconnection strategy (再接続戦略)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#salesforce/salesforce-connector-reference.adoc#reconnect" class="xref unresolved">「Reconnect (再接続)」</a>​、​<a href="#salesforce/salesforce-connector-reference.adoc#reconnect-forever" class="xref unresolved">「Reconnect Forever (繰り返し再接続)」</a>​、および​<a href="#configuring-reconnection-strategy">XML での再接続戦略の設定</a>​を参照してください。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">いいえ</p></td>
</tr>
</tbody>
</table>

## [](#configure-component-attributes)コンポーネント属性を設定する

コンポーネントをインテグレーションプロジェクトに追加したら、コンポーネント UI で属性を設定するか、XML コードエディターで直接属性を設定します。

コネクタ XML タグは、名前空間で始まり操作が続く、構文 ​`namespace:operation`​ に従います。たとえば、データベース用 Anypoint Connector (Database Connector) の ​**Select**​ 操作の場合、​`<db:select/>`​ となります。

## [](#configuring-connector-in-xml)XML でのコネクタの設定

Unresolved include directive in modules/ROOT/pages/introduction/intro-config-use-acb.adoc - include::connectors::partial$acb-xml-maven-partial.adoc\[\] Unresolved include directive in modules/ROOT/pages/introduction/intro-config-use-acb.adoc - include::connectors::partial$acb-xml-maven-partial.adoc\[\] Unresolved include directive in modules/ROOT/pages/introduction/intro-config-use-acb.adoc - include::connectors::partial$acb-xml-maven-partial.adoc\[\]

### [](#configuring-streaming-strategy)XML でのストリーミング戦略の設定

ストリーミング戦略を使用して、Mule によるストリームの処理方法を設定できます。

Unresolved include directive in modules/ROOT/pages/introduction/intro-config-use-acb.adoc - include::connectors::partial$acb-xml-examples.adoc\[\]

## [](#configuring-reconnection-strategy)XML での再接続戦略の設定

Unresolved include directive in modules/ROOT/pages/introduction/intro-config-use-acb.adoc - include::connectors::partial$acb-xml-examples.adoc\[\]

## [](#関連情報)関連情報

Unresolved include directive in modules/ROOT/pages/introduction/intro-config-use-acb.adoc - include::connectors::partial$configure-acb-connectors-partial.adoc\[\]