Author |
Message
|
mhasan23 |
Posted: Wed Apr 24, 2019 10:10 pm Post subject: SHARED Variable in ESQL for Integration Service (SOAP) |
|
|
Novice
Joined: 12 Oct 2017 Posts: 20
|
Hello all,
I have created an integration service (SOAP based web service), all things are working fine. What I need to safe the hit on database every time when my web service API calls from application or mobile; so I am trying to store some database tables with long live variables for re-usability. So I tried "SHARED" variable concept in integration service project. But the variable is populated only for the single API cycle means when request received variable populated for entire flow cycle when response sends then variable will be null.
Is there any other way around or I am doing anything wrong with this "SHARED" variable.
Code: |
DECLARE DB_RESPONSECODES SHARED ROW; |
This is how i declared SHARED variable. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Apr 25, 2019 4:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Without seeing the rest of your code, I would posit that the SHARED variable you're declaring is not in scope for the next iteration / API call.
You might want to consider using the global cache for this. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mpong |
Posted: Thu Apr 25, 2019 5:44 am Post subject: |
|
|
Disciple
Joined: 22 Jan 2010 Posts: 164
|
Quote: |
Is there any other way around or I am doing anything wrong with this "SHARED" variable. |
You should be able to achieve this using Shared variable. Can you try something like this?
DECLARE CACHE_COUNT SHARED ROW NULL;
SET CACHE_COUNT .GroupName = InputRoot.DFDL.BulkRecordOutput.record.EmailGroup; |
|
Back to top |
|
 |
mhasan23 |
Posted: Thu Apr 25, 2019 10:17 pm Post subject: |
|
|
Novice
Joined: 12 Oct 2017 Posts: 20
|
@Vitor Thanks a lot it works
Code: |
DECLARE CACHE_COUNT SHARED ROW NULL;
SET CACHE_COUNT .GroupName = InputRoot.DFDL.BulkRecordOutput.record.EmailGroup; |
This code is working. Thanks again  |
|
Back to top |
|
 |
mhasan23 |
Posted: Thu Apr 25, 2019 10:19 pm Post subject: |
|
|
Novice
Joined: 12 Oct 2017 Posts: 20
|
|
Back to top |
|
 |
timber |
Posted: Thu Apr 25, 2019 11:40 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
One thing to be aware of: when using SHARED variables, you sometimes need an ATOMIC block around the updates to ensure that multiple message flow instances can safely use the same variable. Only required if additionalInstances > 0. |
|
Back to top |
|
 |
|