You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/08/25 07:46:20 UTC

[jira] [Commented] (CAMEL-9065) Exchange created needs to be aware of its FROM endpoint.

    [ https://issues.apache.org/jira/browse/CAMEL-9065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15436435#comment-15436435 ] 

ASF GitHub Bot commented on CAMEL-9065:
---------------------------------------

GitHub user YoshikiHigo opened a pull request:

    https://github.com/apache/camel/pull/1142

    An additional modification for CAMEL-9065 

    This commit includes an additional modification for CAMEL-9065.
    Components should create Exchange from super (46a9a5b4926fd845042577f18ea6a935d2f5f91d).
    
    Yoshiki, Shinpei, Hideaki, and Mei


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/YoshikiHigo/camel fix08

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1142.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1142
    
----
commit fa7c029acba9898f438ec34a226716b4c7d1d3cd
Author: Yoshiki Higo <yo...@gmail.com>
Date:   2016-08-25T07:40:15Z

    An additional modification for CAMEL-9065 (Components should create Exchange from super)

----


> Exchange created needs to be aware of its FROM endpoint. 
> ---------------------------------------------------------
>
>                 Key: CAMEL-9065
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9065
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mongodb
>    Affects Versions: 2.15.2
>            Reporter: omar alles
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.16.0
>
>
> In 2.16, DefaultRuntimeEndpointRegistry (an EventNotifier) is extended to being able to handle ExchangeCreatedEvent s. 
> In its notify(EventObjet), when processing an ExchangeCreateEvent, a reference to exchange's from endpoint is needed in order to obtain its endpoint uri. 
> {code:title=DefaultRuntimeEndpointRegistry.java|borderStyle=solid}
> } else if (extended && event instanceof ExchangeCreatedEvent) {
>             // we only capture details in extended mode
>             ExchangeCreatedEvent ece = (ExchangeCreatedEvent) event;
>             Endpoint endpoint = ece.getExchange().getFromEndpoint();
>             String routeId = ece.getExchange().getFromRouteId();
>             String uri = endpoint.getEndpointUri();
>             String key = asUtilizationKey(routeId, uri);
>             if (key != null) {
>                 inputUtilization.onHit(key);
>             }
> {code}
> The problem is located in MongoDbEndpoint createMongoDbExchange)() 
> {code:title=MongoDbEndpoint.java|borderStyle=solid}
> public Exchange createMongoDbExchange(DBObject dbObj) {
>         Exchange exchange = new DefaultExchange(this.getCamelContext(), getExchangePattern()); 
>         ...
>     }
> {code}
> This Exchange constructor does not take into consideration exchange's from endpoint, consequently causing a NPE when processing its associated ExchangeCreatedEvent.
> When constructing an exchange,  MongoDbEndpoint should use its parent 's createExchange() which uses the proper Exchange constructors. 
> {code:title=MongoDbEndpoint.java|borderStyle=solid}
> public Exchange createMongoDbExchange(DBObject dbObj) {
> //        Exchange exchange = new DefaultExchange(this.getCamelContext(), getExchangePattern());
>         Exchange exchange = super.createExchange();
> ...
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)