Enrich headers of message

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Enrich headers of message

lsantos
Hi there,

I will start off by describing what I am willing to accomplish.

I need to process a file line by line, pluck out a field from each file record, make two rest api calls, the first one to get a json web token, the second one use the token from the first api call in the header and return information that I will replace in the file record. In the end I just stream the modified file record to sftp transfer.

I was wondering if it would be possible to enrich the headers of the message by using information from the rest api calls without modifying the body of the message.
Reply | Threaded
Open this post in threaded view
|

AW: Enrich headers of message

Jan Matèrne (jhm)
Yes.
A Message contains properties and IN and OUT parts consisting each of header
values and the body.

Jan

> -----Ursprüngliche Nachricht-----
> Von: lsantos [mailto:[hidden email]]
> Gesendet: Donnerstag, 3. November 2016 18:09
> An: [hidden email]
> Betreff: Enrich headers of message
>
> Hi there,
>
> I will start off by describing what I am willing to accomplish.
>
> I need to process a file line by line, pluck out a field from each file
> record, make two rest api calls, the first one to get a json web token,
> the second one use the token from the first api call in the header and
> return information that I will replace in the file record. In the end I
> just stream the modified file record to sftp transfer.
>
> I was wondering if it would be possible to enrich the headers of the
> message by using information from the rest api calls without modifying
> the body of the message.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Enrich-
> headers-of-message-tp5789717.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Enrich headers of message

owain
In reply to this post by lsantos
I think all you are wanting to do is save the file record (body) to your own header called, say, filebody, then you can restore filebody header to the exchange body at the end for the out.  In the meantime you can do the enrich with the setBody to some data from header.filebody

In summary, your own headers are very useful to save intermediary values during routes.  You should be aware that the propagate through to other routes that take the exchange as an input (e.g. a wire tap) so you might want to delete them before you send on the exchange.

O.

 
Reply | Threaded
Open this post in threaded view
|

Re: Enrich headers of message

lsantos

 

Sweet, thanks for the input guys.
 
I am exploring the headers alternative like you mentioned @owain.
---

Leandro Bueno Santos

 

On 03/11/2016 14:33, owain [via Camel] wrote:

I think all you are wanting to do is save the file record (body) to your own header called, say, filebody, then you can restore filebody header to the exchange body at the end for the out.  In the meantime you can do the enrich with the setBody to some data from header.filebody

In summary, your own headers are very useful to save intermediary values during routes.  You should be aware that the propagate through to other routes that take the exchange as an input (e.g. a wire tap) so you might want to delete them before you send on the exchange.

O.

 


If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Enrich-headers-of-message-tp5789717p5789721.html
To unsubscribe from Enrich headers of message, click here.
NAML