コンテキスト変数はRESTサービスプロバイダーでサポートされており、データサービスのコンシューマーエンドポイントで利用できます。これにより、エンドポイントをコンテキスト化しながら、複数の対話するサービスをTalend Studioでローカルに実行できるため、異なるコンテキストを使用してさまざまな環境にサービスをデプロイできます。
Talendでサポートされているテクノロジーの詳細は、Talendコンポーネントをご覧ください。
絶対パスか相対パスを使い、tRESTRequest、tRESTClient、cRESTのエンドポイントURLでコンテキスト変数を使用することができます。
たとえば、次のコンテキスト変数はTalend Studioで定義されています。
[Context] (コンテキスト) | 値 |
---|---|
|
|
context.full_b |
http://localhost:8090/customers |
context.full_c |
http://localhost:8090/any/customers |
|
/customers |
|
/services/customers |
|
8090 |
|
8091 |
コンテキスト変数を使用してエンドポイントURLを指定すると、サービスは次のアドレスで公開されます。
[Endpoint] (エンドポイント) | Studio | Runtime (ランタイム) | マイクロサービス(app/docker) |
---|---|---|---|
|
|
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 |
|
http://localhost:8090/customers |
http://localhost:8040/services/customers |
http://localhost:8065/services/customers |
|
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 |
|
http://localhost:8090/customers/rest |
http://localhost:8040/services/customers/rest |
http://localhost:8065/services/customers/rest |
|
http://localhost:8090/customers/<DynamicOSLoginUserName> |
http://localhost:8040/services/customers/<DynamicOSLoginUserName> |
http://localhost:8065/services/customers/<DynamicOSLoginUserName> |
System.getProperty
などのJavaコードが含まれている場合、ユーザーは Talend Runtimeまたはマイクロサービスでバンドルを実行する前にこのプロパティを設定する必要があります。そうしないと、プロパティが欠落しているため、エラーが発生します。