Powered by Zoomin Software. For more details please contactZoomin

MarkLogic Data Hub

Gradleの使用

  • Last Updated: April 5, 2026
  • 10 minute read

Gradleによるステップの作成とFlowへの追加

開始する前に

以下が必要です。

このタスクについて

Flowには少なくとも1つのステップが必要です。GradleによるFlowを作成する場合、結果のFlow定義ファイルには、事前定義された各タイプのステップ(読み込み、マッピング、マスタリング)のサンプルコードが含まれます。

Flowを作成した後、Gradleタスク**hubCreateStepDefinition**を使用して、カスタマイズ可能なステップ定義を初期化できます。次に、ステップ定義ファイルからJSONをコピーしてFlow定義ファイルに貼り付ける必要があります。

手順

これらの命令をカスタマイズするには、作成するステップのタイプを選択します。

IngestionMappingMasteringCustom

  1. Gradleによる、ステップの定義を作成します。
    1. コマンドラインウィンドウを開き、プロジェクトのルートディレクトリに移動します。

    2. プロジェクトルートで、Gradleタスク**hubCreateStepDefinition**を実行します。この場合、ingestionとしてstepTypeを設定します。mappingとしてstepTypeを設定します。masteringとしてstepTypeを設定します。customとしてstepTypeを設定します。

      Unixシステム

./gradlew hubCreateStepDefinition -PstepDefName=your-ingestion-step-name -PstepDefType=ingestion
    **Windows**
gradlew.bat hubCreateStepDefinition -PstepDefName=your-ingestion-step-name -PstepDefType=ingestion
    **Unixシステム**
./gradlew hubCreateStepDefinition -PstepDefName=your-mapping-step-name -PstepDefType=mapping
    **Windows**
gradlew.bat hubCreateStepDefinition -PstepDefName=your-mapping-step-name -PstepDefType=mapping
    **Unixシステム**
./gradlew hubCreateStepDefinition -PstepDefName=your-mastering-step-name -PstepDefType=mastering
    **Windows**
gradlew.bat hubCreateStepDefinition -PstepDefName=your-mastering-step-name -PstepDefType=mastering
    **Unixシステム**
./gradlew hubCreateStepDefinition -PstepDefName=your-custom-step-name -PstepDefType=custom
    **Windows**
gradlew.bat hubCreateStepDefinition -PstepDefName=your-custom-step-name -PstepDefType=custom
    <div class="note">
    
    **注:**デフォルトのstepTypeは`custom`です。
    
    </div>
    
    **Result:**
    
    ステップ定義ファイルが作成されます。
your-project-root/step-definitions/ingestion/your-ingestion-step-name/your-ingestion-step-name.step.json
your-project-root/step-definitions/mapping/your-mapping-step-name/your-mapping-step-name.step.json
your-project-root/step-definitions/mastering/your-mastering-step-name/your-mastering-step-name.step.json
your-project-root/step-definitions/custom/your-custom-step-name/your-custom-step-name.step.json
3.  ステップ定義ファイルで、modulePathの値をこのステップのカスタムモジュールへの正しいパスに置き換えます。
{ "name" : "your-step-name", "type" : "the-step-type", "version" : 1, "options" : { "collections" : [ "your-step-name" ], "outputFormat" : "json" }, "customHook" : { }, "language" : "zxx", "modulePath" : "/path/to/your/step/module/main.sjs", "identifier" : null }
  1. ステップをFlowに手動で追加します。

    1. テキストエディタで、ステップ定義ファイルを開きます。

      デフォルトの読み込みステップ定義ファイルには、以下が含まれています。

{ "language" : "zxx", "name" : "your-ingestion-step-def-name", "description" : null, "type" : "INGESTION", "version" : 1, "options" : { "collections" : [ "your-ingestion-step-def-name" ], "outputFormat" : "json", "targetDatabase" : "data-hub-STAGING" }, "customHook" : { }, "modulePath" : "/custom-modules/ingestion/your-ingestion-step-def-name/main.sjs", "retryLimit" : 0, "batchSize" : 100, "threadCount" : 4, "fileLocations" : { "inputFilePath" : "", "outputURIReplacement" : "", "inputFileType" : "" } }
2.  同様に、Flow定義ファイルを開きます。
    
    Flow定義ファイルは、`your-project-root/flows`にあります。
    
    ステップのないデフォルトのFlow定義ファイルには、以下が含まれています。
{ "name" : "your-flow-name", "description" : "flow description", "identifier" : "", "steps" : {} }
3.  `steps`ノードでは、ステップをキー/バリューペアとして追加します。
    
    *   キーには、シーケンスのステップの順序を表す数字を含む文字列を入力します。 <div class="note">
        
        **注:**Flowの`steps`ノード内でキーが一意である限り、ステップは任意の順序でリストに含めることができます。キーが重複すると、想定しない結果が生じる場合があります。キー番号は0より大きくする必要があります。
        
        </div>
    *   バリューには、ステップ定義ファイルのコンテンツ全体をコピーして貼り付けます。
    
4.  Flow定義ファイルでステップを編集します。
    
    *   nameの設定をstepDefinitionNameに変更します。
    *   typeの設定をstepDefinitionTypeに変更します。
    *   新しいnameの設定を作成し、ステップの名前を割り当てます。
    *   (オプション)次の設定を削除します。
        
        *   language
        *   version
        *   modulePath
        
        これらの設定の値は、ステップ定義から取得されます。
        
    

最初のステップ(「1」)としてデフォルトの読み込みステップをデフォルトのFlowに追加すると、Flow定義ファイルは次のようになります。
{ "name": "your-flow-name", "description": "", "batchSize": 100, "threadCount": 4, "options": { "sourceQuery": null }, "steps": { "1": { "name" : "your-step-name", "stepDefinitionName" : "your-ingestion-step-def-name", "description" : null, "stepDefinitionType" : "INGESTION", "options" : { "collections" : [ "your-ingestion-step-name" ], "outputFormat" : "json", "targetDatabase" : "data-hub-STAGING" }, "customHook" : { }, "retryLimit" : 0, "batchSize" : 100, "threadCount" : 4, "fileLocations" : { "inputFilePath" : "", "outputURIReplacement" : "", "inputFileType" : "" } } } }

See Also

前のトピック:GradleによるFlowの作成

次のトピック:GradleによるFlowの実行

関連する概念

関連タスク

関連リファレンス

TitleResults for “How to create a CRG?”Also Available inAlert