You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Marco Crivellaro (JIRA)" <ji...@apache.org> on 2011/08/19 13:24:27 UTC

[jira] [Created] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

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

                 Key: CAMEL-4354
                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.8.0
         Environment: linux/windows
            Reporter: Marco Crivellaro


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.

{code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
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());
            
    	}
		
	}

}
{code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-4354:
----------------------------------

    Assignee: Claus Ibsen

> header added using an EventNotifier is not present at AggregationStrategy for http endpoints
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4354
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.0
>         Environment: linux/windows
>            Reporter: Marco Crivellaro
>            Assignee: Claus Ibsen
>
> 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.
> {code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
> 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());
>             
>     	}
> 		
> 	}
> }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087755#comment-13087755 ] 

Claus Ibsen commented on CAMEL-4354:
------------------------------------

Marco which http component did you use? http4 or the regular http, or the jetty http producer?

> header added using an EventNotifier is not present at AggregationStrategy for http endpoints
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4354
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.0
>         Environment: linux/windows
>            Reporter: Marco Crivellaro
>
> 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.
> {code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
> 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());
>             
>     	}
> 		
> 	}
> }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

Posted by "Marco Crivellaro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13088555#comment-13088555 ] 

Marco Crivellaro commented on CAMEL-4354:
-----------------------------------------

shall we consider a better practice using an exchange property instead of an header?

> header added using an EventNotifier is not present at AggregationStrategy for http endpoints
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4354
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.0
>         Environment: linux/windows
>            Reporter: Marco Crivellaro
>            Assignee: Claus Ibsen
>             Fix For: 2.9.0
>
>
> 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.
> {code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
> 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());
>             
>     	}
> 		
> 	}
> }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-4354.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.9.0

ExchangeSentEvent is now emitted when producer is done for both sync/async routing.

> header added using an EventNotifier is not present at AggregationStrategy for http endpoints
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4354
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.0
>         Environment: linux/windows
>            Reporter: Marco Crivellaro
>            Assignee: Claus Ibsen
>             Fix For: 2.9.0
>
>
> 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.
> {code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
> 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());
>             
>     	}
> 		
> 	}
> }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087659#comment-13087659 ] 

Claus Ibsen commented on CAMEL-4354:
------------------------------------

This is actually a miss usage of the EventNotifer as the idea it is a read-only event notification mechanism.
Any changes on headers is not meant to guaranteed to be preserved etc. 

> header added using an EventNotifier is not present at AggregationStrategy for http endpoints
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4354
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.0
>         Environment: linux/windows
>            Reporter: Marco Crivellaro
>
> 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.
> {code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
> 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());
>             
>     	}
> 		
> 	}
> }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087663#comment-13087663 ] 

Claus Ibsen commented on CAMEL-4354:
------------------------------------

Also make sure you set the header on the correct IN or OUT. See
http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html

The exchange may very well have an OUT message already, so you should populate it correctly. Storing the detail directly on the Exchange as a property will always preserve it.

> header added using an EventNotifier is not present at AggregationStrategy for http endpoints
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4354
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.0
>         Environment: linux/windows
>            Reporter: Marco Crivellaro
>
> 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.
> {code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
> 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());
>             
>     	}
> 		
> 	}
> }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087758#comment-13087758 ] 

Claus Ibsen commented on CAMEL-4354:
------------------------------------

Okay the ExchangeSentEvent is being fired to early for async routing engine. For synchronous routing, the event is emitted *after* the producer has completed. For async routing is emitted just after the producer have send, but not waiting for until its done. To keep it consistent we ought to fire the event when the producer is done. Then its the same for sync and async.

> header added using an EventNotifier is not present at AggregationStrategy for http endpoints
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4354
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.0
>         Environment: linux/windows
>            Reporter: Marco Crivellaro
>            Assignee: Claus Ibsen
>
> 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.
> {code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
> 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());
>             
>     	}
> 		
> 	}
> }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

Posted by "Marco Crivellaro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087690#comment-13087690 ] 

Marco Crivellaro commented on CAMEL-4354:
-----------------------------------------

fixed by making use of exchange property

{code:java}
eventSent.getExchange().setProperty("x-time-taken", eventSent.getTimeTaken());
{code}

> header added using an EventNotifier is not present at AggregationStrategy for http endpoints
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4354
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.0
>         Environment: linux/windows
>            Reporter: Marco Crivellaro
>
> 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.
> {code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
> 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());
>             
>     	}
> 		
> 	}
> }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4354) header added using an EventNotifier is not present at AggregationStrategy for http endpoints

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-4354:
-------------------------------

    Fix Version/s: 2.8.1

> header added using an EventNotifier is not present at AggregationStrategy for http endpoints
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4354
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4354
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.0
>         Environment: linux/windows
>            Reporter: Marco Crivellaro
>            Assignee: Claus Ibsen
>             Fix For: 2.8.1, 2.9.0
>
>
> 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.
> {code:title=ExchangeSentEventNotifier.java|borderStyle=solid}
> 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());
>             
>     	}
> 		
> 	}
> }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira