Couldn't find a clean solution for this so I've created a JIRA issue: CAMEL 
12989 Allow Endpoint to set the key that ProducerCache uses

I've also created an implementation and submitted a PR.

Solution works well and I now have the ability to use a RecipientList with the 
CXFEndpoints that have the same URI but different SSL certificates.


________________________________
From: users-return-68000-Richard.Davis=boots.co...@camel.apache.org 
<users-return-68000-Richard.Davis=boots.co...@camel.apache.org>
Sent: 07 December 2018 16:28:18
To: users@camel.apache.org
Subject: [CAUTION] RE: Configuring a CFXEndPoint with multiple certificates

That solution is actually not very efficient as the Producer will continually 
be created if the RecipientList endpoints are constantly changing which is 
likely for my case. The problem is that the cache is keyed on the URI but for 
my use case this is not enough. I really need the ability to set the 
ProducerCache key programmatically much as I can when I add the Endpoint to the 
CamelContext.

Extending the CXFEndPoint and overriding getEndpointUri would not work as the 
Uri is always the same and adding extra characters to the returned result would 
break the actual communication.

Really I need something like:

 protected synchronized Producer doGetProducer(Endpoint endpoint, boolean 
pooled) {
        String key = endpoint.getProducerCacheKey(); // new method on Endpoint 
or Service interface
        Producer answer = producers.get(key);

I could then implement / override the getProducerCacheKey() myself.

Boots UK Limited, Registered 928555, Nottingham NG2 3AA This e-mail (including 
any attachments) is confidential. It may be read, copied and used only by the 
intended recipient. If you are not the intended recipient you should not copy 
it or use it for any purpose or disclose its contents to any other person. If 
you have received this message in error, please notify us and remove it from 
your system. We cannot accept liability for any damage you incur as a result of 
virus infection.
Boots UK Limited, Registered 928555, Nottingham NG2 3AA This e-mail (including 
any attachments) is confidential. It may be read, copied and used only by the 
intended recipient. If you are not the intended recipient you should not copy 
it or use it for any purpose or disclose its contents to any other person. If 
you have received this message in error, please notify us and remove it from 
your system. We cannot accept liability for any damage you incur as a result of 
virus infection.

Reply via email to