Powered by Zoomin Software. For more details please contactZoomin

MarkLogic Data Hub

データハブAPIの使用

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

データハブJava APIによるFlowの実行

このタスクについて

MarkLogicデータハブJava APIを使用して、プログラムでFlowを実行できます。

手順

  1. ビルド設定ファイルで、MarkLogicデータハブJava APIへの依存関係を宣言します。

    Gradle

dependencies { compile('com.marklogic:marklogic-data-hub:5.0.0') }
**Maven**
<dependency><groupId>com.marklogic</groupId><artifactId>marklogic-data-hub</artifactId><version>5.0.0</version><type>pom</type></dependency>
**Ivy**
<dependency org='com.marklogic' name='marklogic-data-hub' rev='5.0.0'><artifact name='$AID' ext='pom'></artifact></dependency>
  1. 次のコードをコピーし、必要に応じてカスタマイズします。

    **注:****runFlow**では、Flow内のすべてのステップを実行することも、指定したステップのみを実行することもできます。

package com.marklogic.hub.flow; import com.marklogic.hub.ApplicationConfig; import com.marklogic.hub.HubConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.WebApplicationType; import javax.annotation.PostConstruct; import java.util.Arrays; public class MyApp { // Get a HubConfig instance. @Autowired HubConfig hubConfig; // Get a FlowRunner instance. @Autowired FlowRunner fr; @PostConstruct void runUserFlows() { /* * After Spring creates the HubConfig object and the project is initialized with * createProject(String), you can use setter methods to change the HubConfig properties * and then call the refreshProject() method which will load the HubConfig object with values * from gradle.properties (optionally overridden with gradle-{env}.properties) and the setters. */ hubConfig.createProject("/path/to/your/project"); hubConfig.withPropertiesFromEnvironment("local"); hubConfig.refreshProject(); // Runs the entire flow. RunFlowResponse testFlowResp = fr.runFlow("testFlow"); // Runs only the specified steps. RunFlowResponse mapFlowResp = fr.runFlow("mapFlow", Arrays.asList("1","3")); // Wait for the flow to end. fr.awaitCompletion(); } public static void main(String[] args) { // Start the Spring application. SpringApplication app = new SpringApplication(MyApp.class, ApplicationConfig.class); app.setWebApplicationType(WebApplicationType.NONE); app.run(); } }
  1. コードを実行します。

See Also

関連する概念

関連タスク

関連情報

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