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

Exchange created needs to be aware of its FROM endpoint.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.15.2
    • Fix Version/s: 2.16.0
    • Component/s: camel-mongodb
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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.

      DefaultRuntimeEndpointRegistry.java
      } 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);
                  }
      

      The problem is located in MongoDbEndpoint createMongoDbExchange)()

      MongoDbEndpoint.java
      public Exchange createMongoDbExchange(DBObject dbObj) {
              Exchange exchange = new DefaultExchange(this.getCamelContext(), getExchangePattern()); 
              ...
          }
      

      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.

      MongoDbEndpoint.java
      public Exchange createMongoDbExchange(DBObject dbObj) {
      //        Exchange exchange = new DefaultExchange(this.getCamelContext(), getExchangePattern());
              Exchange exchange = super.createExchange();
      ...
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                omaralles omar alles
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: