How to get pipeline values in Catch block

Hi,

I’m working with an integration where I need to store messageIDs into internal database for both success and failure cases. If try failed, I need to get messageIDs from pipeline value from try and to log the messageIDs into our database.

SEQUENCE (main)
— SEQUENCE (try)
------ Webservice call (get messageIDs)
------ Transformation
------ JMS Posting
— SEQUENCE (catch)
------ getLastError
------ Log in database with messageID and errormessage
------ Exit Flow and signal Failure

This can be achieved by using pub.storage.put and pub.storage.get. Apart from this, could anyone please suggest the solution to get pipeline values into catch block?

Thank you.

you can use try catch regressively. For each major action, you should put a Try-Catch around it.
So your message-ID will be available in the pipeline for the next try catch if error happens.
look like this:

SEQUENCE (main)
— SEQUENCE (try)
------ Webservice call (get messageIDs)
SEQUENCE (2)
— SEQUENCE (try2)
------ Transformation
------ JMS Posting
— SEQUENCE (catch2)
------ getLastError
------ Log in database with messageID and errormessage
------ Exit Flow and signal Failure
— SEQUENCE (catch)
------ getLastError
------ Log in database without messageID , with errormessage
------ Exit Flow and signal Failure

Sasikanth,

The easiest thing for you here may be to use the pipeline object that is available inside of the lastError document. That pipeline object should contain all variables that were present at the time of the error. Do not use pub.storage for this. In fact, I would argue there’s rarely a good reason to use pub.storage.

Percio

1 Like