データサービスのRESTエンドポイントURLでコンテキスト変数を使用
コンテキスト変数はRESTサービスプロバイダーでサポートされており、データサービスのコンシューマーエンドポイントで利用できます。これにより、エンドポイントをコンテキスト化しながら、複数の対話するサービスをTalend Studioでローカルに実行できるため、異なるコンテキストを使用してさまざまな環境にサービスをデプロイできます。
Talendでサポートされているテクノロジーの詳細は、Talendコンポーネントをご覧ください。
絶対パスか相対パスを使い、tRESTRequest、tRESTClient、cRESTのエンドポイントURLでコンテキスト変数を使用することができます。
たとえば、次のコンテキスト変数はTalend Studioで定義されています。
| [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> |