One Star

how to change context values of a deployed job as osgi

When exporting a job as OSGi bundle, it does not let you select context scripts as it does when exporting a job as Autonomous Job. In the case of export job as OSGi bundle, how do I change context values based on, for example, the environment it is deployed into: prod, text, dev?
7 REPLIES
Moderator

Re: how to change context values of a deployed job as osgi

Hi,
There is no "Context Scripts" option when you choose export type as OSGi bundle(deploy job into runtime).
You have to create a config file (config:edit) manually by Talend ESB runtime where there is context parameter you set.
Feel free post your issue.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: how to change context values of a deployed job as osgi

Do I create one cfg file per job? If so, what its naming convention? Where should it reside in order for the job being able to find it?
How about this "hack": in the created OSGi bundle jar file, edit the file context\Defaults.properties before deploying it into the runtime environment.
Thanks
Moderator

Re: how to change context values of a deployed job as osgi

Hi,
Do I create one cfg file per job? If so, what its naming convention? Where should it reside in order for the job being able to find it?How about this "hack": in the created OSGi bundle jar file, edit the file context\Defaults.properties before deploying it into the runtime environment.

You need create one cfg file per job and the .cfg file name must be consistent with your service name/job name. You have to put it into <TalendRuntimeInstallationPath>\container\etc so that Talend runtime can find it and deploy.
I never use "hack" before. Sorry for no suggestion on it.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: how to change context values of a deployed job as osgi

What is the format of cfg file ?
Is there a cfg sample file generated by container, or a way to make the container generate one ?
Regards,
Christophe
One Star

Re: how to change context values of a deployed job as osgi

The format of cfg file is quite straightforward:
param1_name = param1_value_with_no_quotes
param2_name = param2_value_with_no_quotes

You can update parameter of your running job/service in two ways
File configuration

Create your_job_name.cfg file in containter/etc
Fill it with data with given format
Refresh job via web console or via Talend Runtime client (refresh job_id)
Console configuration

Open Talend Runtime/ Karaf console client (./container/bin/client)
Then type something like in below example:
karaf@trun()>config:edit your_job_name
karaf@trun()>config:property-set param1_name param1_value_with_no_quotes (NOTICE! no equals sign)
karaf@trun()>config:update
karaf@trun()>refresh job_id (NOTICE! you can aquire job_id when you type list into console)

Re: how to change context values of a deployed job as osgi

Hello,
I am relatively new to Talend.
I have a too many jobs. Every job has 3 contexts : development, uat and production.
Every time I want to change the contexts for all the jobs, I have to change the default context for every job and then export the service, it takes too much time.
I tried following your steps.
I created a cfg file having the same name as one of the jobs.
For example, one job is named : SubscriberInfo.
So I created SubscriberInfo.cfg under container/etc and then I executed the command " refresh <jobid> " where <jobid> is the actual job id.
Nothing happened.
The content of the cfg file is :
context=UAT
What am I doing wrong ??
Thanks.
One Star

Re: how to change context values of a deployed job as osgi

Hi Elias
In the .cfg file, I believe the syntax is

context = UAT
prop1=karaf-prop1-override

note the spaces for "context".