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

header added using an EventNotifier is not present at AggregationStrategy for http endpoints

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.0
    • 2.8.1, 2.9.0
    • camel-core
    • None
    • linux/windows

    • Unknown

    Description

      A new header added using an EventNotifier is not present when the exchange is aggregated with an AggregationStrategy.
      This is happening only if the enpoint type is http, ftp doesn't have this issue.

      This was working with an early version of 2.8.0-SNAPSHOT

      Following the EventNotifier code used.

      ExchangeSentEventNotifier.java
      public class ExchangeSentEventNotifier extends EventNotifierSupport {
      
      	@Override
      	protected void doStart() throws Exception {
              /*
               *  filter out unwanted events
               *  we are interested only in ExchangeSentEvent
               */
              setIgnoreCamelContextEvents(true);
              setIgnoreServiceEvents(true);
              setIgnoreRouteEvents(true);
              setIgnoreExchangeCreatedEvent(true);
              setIgnoreExchangeCompletedEvent(true);
              setIgnoreExchangeFailedEvents(true);
              setIgnoreExchangeSentEvents(false);		
      	}
      
      	@Override
      	protected void doStop() throws Exception {
      
      	}
      
      	@Override
      	public boolean isEnabled(EventObject event) {
      		return event instanceof ExchangeSentEvent;
      	}
      
      	@Override
      	public void notify(EventObject event) throws Exception {
          	if(event.getClass() == ExchangeSentEvent.class){
                  ExchangeSentEvent eventSent = (ExchangeSentEvent)event;
                  
                  log.debug("Took " + eventSent.getTimeTaken() + " millis to send to: " + eventSent.getEndpoint());
      
                  //storing time taken to the custom header            
                  eventSent.getExchange().getIn().setHeader("x-time-taken", eventSent.getTimeTaken());
                  
          	}
      		
      	}
      
      }
      

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            crive Marco Crivellaro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: