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 2015/08/09 14:07:45 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=14679116#comment-14679116 ] 

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

GitHub user oalles opened a pull request:

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

    Exchange created needs to be aware of its FROM endpoint. 

    https://issues.apache.org/jira/browse/CAMEL-9065

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

    $ git pull https://github.com/oalles/camel mongodb-exchange-construction

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

    https://github.com/apache/camel/pull/591.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 #591
    
----
commit 7f38e79e339d28dcc15e4cda0773ca239b43f0fc
Author: oalles <oa...@gmail.com>
Date:   2015-08-09T12:02:36Z

    createMongoDbExchange should call its parent createExchange, so the
    proper exchange constructors are called.
    
    https://issues.apache.org/jira/browse/CAMEL-9065

----


> 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
>            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)