Consuming the SayHelloService according to the environment via Provisioning
If you used the tesb:start-all command to start all the Talend Infrastructure services, the Provisioning Service is already started.
If not, go back to the container and start it as follows:
-
tesb:start-provision-server
-
tesb:start-provision-agent
Consume the SayHelloService in a development environment.
-
Create a profile with the feature, resource and placeholder needed for the development environment.
tprovision:profile-create dev_env dev
-
Add the feature you previously published in the Artifact Repository:
tprovision:feature-create dev_env mvn:org.example/SayHelloConsumer-feature/0.1.0-SNAPSHOT/xml SayHelloConsumer-feature 0.1.0-SNAPSHOT
-
Add the resource that will contain the context used by the SayHelloConsumer:
tprovision:resource-create dev_env etc/SayHelloConsumer.cfg
-
Add the placeholder providing the dev context to apply to the SayHelloConsumer:
tprovision:placeholder-create dev environment dev
-
Release the placeholder:
tprovision:placeholders-release dev 1.0
-
Release the profile:
tprovision:profile-release dev_env 1.0 dev 1.0
-
Now that the new dev_env profile has been released, you can apply it to the container on which you deployed the SayHelloService, it will automatically deploy the SayHelloConsumer feature in the Talend Runtime Container with the corresponding context (the environment placeholder will be dynamically replaced by its value: dev, which corresponds to the karaf credentials defined in the Job context variables) allowing it to consume the service.
To apply the dev_env profile, use the following command:
tprovision-agent:apply-profiles dev_env 1.0
Consume the SayHelloService in a production environment.
-
Create a profile with the feature, resource and placeholder needed for the production environment:
tprovision:profile-create prod_env prod
-
Add the feature you previously published in the Artifact Repository:
tprovision:feature-create prod_env mvn:org.example/SayHelloConsumer-feature/0.1.0/xml SayHelloConsumer-feature 0.1.0
-
Add the resource that will contain the context used by the SayHelloConsumer:
tprovision:resource-create prod_env etc/SayHelloConsumer.cfg
-
Add the placeholder providing the prod context to apply to the SayHelloConsumer:
tprovision:placeholder-create prod environment prod
-
Release the placeholder:
tprovision:placeholders-release prod 1.0
-
Release the profile:
tprovision:profile-release prod_env 1.0 prod 1.0
-
Now that the new prod_env profile has been released, you can apply it to the container on which you deployed the SayHelloService, it will automatically deploy the SayHelloConsumer feature in the Talend Runtime Container with the corresponding context (the environment placeholder will be dynamically replaced by its value: prod, which corresponds to the tadmin credentials defined in the Job context variables) allowing it to consume the service.
To apply the prod_env profile, use the following command:tprovision-agent:apply-profiles prod_env 1.0
The creation of profiles described above, performed directly in the Talend Runtime Container can be performed as well from the Provisioning page of the Talend Administration Center. For more information, see the Talend Administration Center User Guide.