Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16325

CamelFileNameProduced header not coming when there is no data in the file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • None
    • None
    • came-core
    • None
    • Unknown

    Description

      Hi,

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            nishtha.rai Nishtha Rai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: