InsideDarkWeb.com

Apache Camel - How to make a value accessible across the entire route?

I am trying out a Camel route that queries a table (with primary key), generates a CSV based on the query response and stores the CSV file in Azure storage container. After successfully storing the file in Azure, I need to update a flag in the table that was queried initially. For this purpose I am setting the primary key as part of the header, but after the azure endpoint is executed, the header values are getting reset. So I am not able to retrieve the initial header and hence the primary key value which I need. What is the ideal way to store a value that is accessible during the entire route?

from("direct:processPayroll")
  .setHeader("payrollId",simple("${body.payrollId}"))
  .to("sql:classpath:sql/payroll.sql")
  .marshal(csvFormat)
  .log("${headers}")
  .to("azure-storage-blob://staccount/container?blobName=payroll.csv&operation=uploadBlockBlob")
  .log("${headers}")

Stack Overflow Asked by Saud on November 18, 2021

1 Answers

One Answer

You can store it in the exchange properties. You can add the value using .setProperty("key","value") and retrieve it using $exchangeProperty("key")

Answered by Sneharghya Pathak on November 18, 2021

Add your own answers!

Related Questions

clock() returning negative time difference on Windows machine

1  Asked on December 3, 2020 by a-sinha

   

Can I constrain constructor parameters in C#

2  Asked on December 2, 2020 by batekha

 

How to add a number to the picture php

0  Asked on December 2, 2020 by user13670828

         

Flutter: SilverAppBar Background Image with Text

2  Asked on December 2, 2020 by gsk

 

Why does the color editor in Blend stop working?

1  Asked on December 1, 2020 by vladimir-yudin

     

eCharts marker line is cutting off text

2  Asked on December 1, 2020 by sanya

     

how do i connect my mongodb to my laptop?

2  Asked on December 1, 2020 by omojuwon-soneye

         

How to write text over an image?

2  Asked on December 1, 2020 by hichem-neggaz

     

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.