Hi-
I have a processor that creates 2 different JSON requests/output messages; I'll
call them JSON1 and JSON2.
JSON1 needs to post to an external api, and then, if response code is 201,
JSON2 needs to post to the same external api.
How do I "save" or route the output messages?
To make matters worse, the external api requires an OAuth2 token.
Currently, I set exchange property for each JSON1 and JSON2, but that seems to
be a "hack" and I'm afraid that I will exceed any property size limit.
Processor
Set property JSON1
Set property JSON2
Call OAuth2 route to get token
Set Header with access token
Call external api
Set Body with property JSON1
Get/set header access token
POST to api
Call OAuth2 route to get token (in case the first one expired)
Set Header with access token
Call external api
Set Body with property JSON2
Get/set access token
POST to api
There must be a better way? Any suggestions? Thanks in advance.
(stack: Camel 2.24, Java 1.8, Spring Boot rest service)
(PS How do I reply to messages in this forum?)
***************************************************************************
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally
privileged.
If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.
If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.
Thank You.
****************************************************************************