Thanks Rajjaz.

Firstly, I don't want to use a script mediator, because it has performance
issues with high concurrency. Secondly, I want to execute a piece of code
when the connector is deployed and enabled. I've implemented
ManagedLifecycle and have put my code inside init() and everything works
fine for my usecase. Any issue with this approach?

Thanks,
Raj.

On Sun, Jul 9, 2017 at 2:26 AM, Rajjaz Mohammed <[email protected]> wrote:

> Hi Raj,
>
> You can do this by read the system variables and store it in the
> registry[1][2]. If the resource is updated then it will not read again and
> again for every request. Normally we follow this approach to store the
> access token and refresh token variables from the first call.
>
> [1] https://github.com/wso2-extensions/esb-connector-
> googlespreadsheet/blob/master/src/main/resources/config/
> getAccessTokenFromRefreshToken.xml#L54
> [2] https://github.com/wso2-extensions/esb-connector-
> googlespreadsheet/blob/master/src/main/resources/config/init.xml#L69
>
> On Sun, Jul 9, 2017 at 9:12 AM, Rajkumar Rajaratnam <[email protected]>
> wrote:
>
>> Would implementing ManagedLifecycle be the option for this?
>>
>> On Sat, Jul 8, 2017 at 11:20 PM, Rajkumar Rajaratnam <[email protected]>
>> wrote:
>>
>>> Hi,
>>>
>>> I need to execute a piece of code to read some system variables and
>>> initialize my connector. I need to do this only once and IMO it's better to
>>> do this during connector deployment time. I don't want to execute this code
>>> again and again for every requests.
>>>
>>> How do I do this?
>>>
>>> Thanks.
>>>
>>
>>
>>
>> --
>> Rajkumar Rajaratnam
>> Committer & PMC Member, Apache Stratos
>> Senior Software Engineer, WSO2
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Thank you
> Best Regards
>
> *Rajjaz HM*
> Software Engineer
> Platform Extension Team
> WSO2 Inc. <http://wso2.com/>
> lean | enterprise | middleware
> Mobile | +94752833834 <+94%2075%20283%203834>|+94777226874
> <+94%2077%20722%206874>
> Email   | [email protected]
> LinkedIn <https://lk.linkedin.com/in/hmohammedrajjaz> | Blogger
> <http://rajjazhm.blogspot.com/> | WSO2 Profile
> <http://wso2.com/about/team/mohammer-rajjaz/>
> [image: https://wso2.com/signature] <https://wso2.com/signature>
>



-- 
Rajkumar Rajaratnam
Committer & PMC Member, Apache Stratos
Senior Software Engineer, WSO2
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to