[ANNOUNCE] Apache Camel 3.7.3 Released
The Camel PMC is pleased to announce the release of Apache Camel 3.7.3. Apache Camel is an open source integration framework that empowers you to quickly and easily integrate various systems consuming or producing data. This release is a patch release for the LTS 3.7.x branch that contains 36 bug fixes and improvements. The release is available for immediate download at: https://camel.apache.org/download/ For more details please take a look at the release notes at: https://camel.apache.org/releases/release-3.7.3/
CamelFileNameProduced header not coming when there is no data in the file
Hi Team, We have created a simple camel route - @Override@Override public void configure() throws Exception { from("file://C:/in/?fileName=Input_UTF8.txt") .process(exchange -> { System.out.println("Headers after in: "+ exchange.getIn().getHeaders()); } ) .onCompletion() .process(exchange -> { sendFooter(exchange); System.out.println("Headers after Footer: "+ exchange.getIn().getHeaders()); }) .end() .process(exchange -> { sendHeader(exchange); System.out.println("Headers after header: "+ exchange.getIn().getHeaders());}) .split(body().tokenize(lineSeperator)) .streaming() .to("file://C:/out/?fileName=Output.txt&fileExist=Append") .process(exchange -> { System.out.println("Headers after each record: "+ exchange.getIn().getHeaders()); }); } private void sendHeader(Exchange exchange) { ProducerTemplate template = getContext().createProducerTemplate(); template.sendBodyAndHeaders("file://C:/out/?fileName=Output.txt&fileExist=Append","header1,header2",exchange.getIn().getHeaders()); } private void sendFooter(Exchange exchange) { ProducerTemplate template = getContext().createProducerTemplate(); template.sendBodyAndHeaders("file://C:/out/?fileName=Output.txt&fileExist=Append","footer",exchange.getIn().getHeaders()); } CamelFileNameProduced header is not coming when there is no data in the file (header and footer will be there) although it is creating a file in the destination directory. We need the CamelFileNameProduced header even in case of only header and footer in the output file and no data in the file. Could you please help on this. Thanks & Regards Nishtha Rai
Update thread name of threadpool before executing a task
Hi, I have a executorservice build from threadpoolbuilder. public ExecutorService jobThreadPool() throws Exception { return new ThreadPoolBuilder(getContext()).poolSize(50).maxPoolSize(500).keepAliveTime(180).build("jobThread"); } I would like to set thread before executing the task, just like as shown in example which is not recommended. How can we do it correctly? (like in https://stackoverflow.com/questions/8523453/with-threadpoolexecutor-how-to-get-the-name-of-the-thread-running-in-the-thread) jobThreadPool.execute(() -> { //eg. Thread.getCurrentThread().setName("abc"); });
Re: Update thread name of threadpool before executing a task
Hi You can plugin your own thread pool factory where you can control how thread pools (ExecutorService) are created and how these thread pools create threads, where you can do the before / after thread thingy. However what is your use-case for doing this? On Wed, Mar 10, 2021 at 2:06 PM Narsi Reddy Nallamilli wrote: > > Hi, > > I have a executorservice build from threadpoolbuilder. > > public ExecutorService jobThreadPool() throws Exception { > return new > ThreadPoolBuilder(getContext()).poolSize(50).maxPoolSize(500).keepAliveTime(180).build("jobThread"); > } > > I would like to set thread before executing the task, just like as shown > > in example which is not recommended. How can we do it correctly? (like > in > https://stackoverflow.com/questions/8523453/with-threadpoolexecutor-how-to-get-the-name-of-the-thread-running-in-the-thread) > > jobThreadPool.execute(() -> { > //eg. Thread.getCurrentThread().setName("abc"); > }); -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2