メイン コンテンツをスキップする

データサービスのRESTエンドポイントURLでコンテキスト変数を使用

コンテキスト変数はRESTサービスプロバイダーでサポートされており、データサービスのコンシューマーエンドポイントで利用できます。これにより、エンドポイントをコンテキスト化しながら、複数の対話するサービスをStudio Talendでローカルに実行できるため、異なるコンテキストを使用してさまざまな環境にサービスをデプロイできます。

Talendでサポートされているテクノロジーの詳細は、Talendコンポーネントをご覧ください。

絶対パスか相対パスを使い、tRESTRequesttRESTClientcRESTのエンドポイントURLでコンテキスト変数を使用することができます。

たとえば、次のコンテキスト変数はStudio Talendで定義されています。

[Context] (コンテキスト)

context.full_a

http://localhost:8090/services/customers

context.full_b http://localhost:8090/customers
context.full_c http://localhost:8090/any/customers

context.url_a

/customers

context.url_b

/services/customers

context.port_a

8090

context.port_b

8091

コンテキスト変数を使用してエンドポイントURLを指定すると、サービスは次のアドレスで公開されます。

[Endpoint] (エンドポイント) Studio Runtime (ランタイム) マイクロサービス(app/docker)

context.full_a

http://localhost:8090/services/customers

http://localhost:8090/services/customers http://localhost:8090/services/customers
context.full_b http://localhost:8090/customers http://localhost:8090/customers http://localhost:8090/customers
context.full_c http://localhost:8090/any/customers http://localhost:8090/any/customers http://localhost:8090/any/customers

context.url_a

http://localhost:8090/customers http://localhost:8040/services/customers http://localhost:8065/services/customers

context.url_b

http://localhost:8090/services/customers http://localhost:8040/services/customers http://localhost:8065/services/customers
"http://localhost:"+ context.port_b + context.url_b http://localhost:8091/services/customers http://localhost:8091/services/customers http://localhost:8091/services/customers

context.url_a + "/rest"

http://localhost:8090/customers/rest http://localhost:8040/services/customers/rest http://localhost:8065/services/customers/rest

"http://localhost:8090" + context.url_a + "/" + System.getProperty("user.name")

http://localhost:8090/customers/<DynamicOSLoginUserName> http://localhost:8040/services/customers/<DynamicOSLoginUserName> http://localhost:8065/services/customers/<DynamicOSLoginUserName>
情報メモ注: エンドポイントにSystem.getPropertyなどのJavaコードが含まれている場合、ユーザーはTalend Runtimeまたはマイクロサービスでバンドルを実行する前にこのプロパティを設定する必要があります。そうしないと、プロパティが欠落しているため、エラーが発生します。

このページは役に立ちましたか?

このページまたはコンテンツに、タイポ、ステップの省略、技術的エラーなどの問題が見つかった場合は、お知らせください。改善に役立たせていただきます。