Indika_Nuwan95
Indika_Nuwan95

Reputation: 679

How to implement addRegistry(Registry registry) method in apache camel 3.4.0?

We updated one of our projects from camel 2.25.2 to 3.4.0 recently. There was a class called CompositeRegistry, but Camel documentation says it's deprecated or not available in new versions.

So we used DefaultRegistry class and it does not have addRegistry method.

Our old code used CompositeRegistry class and its methods. How can I solve this issue?

Old code:

private void registerSoapEndpoint() {
    
    SimpleRegistry simpleRegistry = new SimpleRegistry();
    CxfEndpoint cxfEndpoint = new SoapEndpoint().getCxfEndpoint();
  
    simpleRegistry.put("TrobuleTicketEndpoint", cxfEndpoint);
    CamelContext camelctx = getContext();

    CompositeRegistry compositeRegistryTest = new CompositeRegistry();

    compositeRegistryTest.addRegistry(camelctx.getRegistry());
    compositeRegistryTest.addRegistry(simpleRegistry);
    ((DefaultCamelContext) camelctx).setRegistry(compositeRegistryTest);
    
}

Upvotes: 1

Views: 435

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55535

The out of the box registry has a bind method so you can add to it - you no longer need to composite anymore.

Upvotes: 1

Related Questions