Problem Removing Endpoints
6 posts
|
This post was updated on
Feb 04, 2012; 5:50am.
I'm attempting to manage routes and endpoints in a camel context using following components (Camel 2.9.0, CXF 2.5.1, AMQ 5.5.1 in karaf 2.2.5). I have a system that requires that the endpoints be dynamically reconfigured, and this requires that I be able to add/remove routes and endpoints.
I am able to remove routes from my camel context, but I'm not able to remove all the endpoints. The endpoints are a combination of the following: 1- jms:queue:jmsQueueEP 2 - jms:topic:jmsTopicEP 3 - seda:sedaEP 4 - CxfEndpoint 1 - 3 are added to the context during route creation using RouteBuilder. 4 is explicitly added to the context. Performing a camelContext.removeEndpoints("*") removes most of the lazy created endpoints. It removes (1) and (3). Performing an explicit removal of (4) - camelContext.removeEndpoints("cxf: https://foo...") is then able to remove the CxfEndpoint. I'm not sure why the wildcard pattern initially used did not work here. Finally, even an explicit attempt to remove the jms topic endpoint was not successful: Collection<Endpoint> removed, endpoints = camelContext.getEndpoints(); for (Endpoint i : endpoints) { String uri = i.getEndpointUri(); logger.debug("removing EP: {}", uri); removed = camelContext.removeEndpoints(i.getEndpointUri()); if (removed == null) { logger.debug("EP not removed: {}", uri); } } Output is: removing EP: jmsvm://topic:CORE_REQUEST_USRMGM removing EP: jmsvm://topic:CORE_ADD_USRMGM This indicates that removeEndpoints should have succeeded, but an examination of the context indicates that the endpoint is still present. Using context.AddRoutes() to add routes with the same endpoints results in duplicate endpoints present in the context. Any ideas as to: - Why the wildcard uri pattern fails to remove the cxf endpoint? - How to remove the jms:topic endpoint? TIA |
1074 posts
|
Tony,
I am putting together a unit test to reproduce your problem. I assume you don't have one handy. The information you provided should be enough to reproduce. Hadrian On 02/03/2012 04:47 PM, Tony Su wrote: > Found a mistake in the original post: > > > Tony Su wrote >> >> if (removed != null) >> { >> logger.debug("EP not removed: {}", uri); >> } >> > > > This should be: > if (removed != null) > { > logger.debug("EP not removed: {}", uri); > } > Output is: > removing EP: jmsvm://topic:CORE_REQUEST_USRMGM > removing EP: jmsvm://topic:CORE_ADD_USRMGM > > This indicates that removeEndpoints should have succeeded, but an > examination of the context indicates that the endpoint is still present. > Using context.AddRoutes() to add routes with the same endpoints results in > duplicate endpoints present in the context. > > -- > View this message in context: http://camel.465427.n5.nabble.com/Problem-Removing-Endpoints-tp5455029p5455127.html > Sent from the Camel - Users mailing list archive at Nabble.com.
... [
show rest of quote]
-- Hadrian Zbarcea Principal Software Architect Talend, Inc http://coders.talend.com/ http://camelbot.blogspot.com/ |
750 posts
|
In reply to
this post by Tony Su
Hi
That was a Javadoc typo as CamelContext.removeEndpoints() would never return null but just an empty Collection if no matching endpoint could be found. So in your case checking it aganist null is obsolete. I did correct it right before on the trunk. Babak |
6 posts
|
I just realized that a little while ago while browsing the source :-) Changing to check for "removed.isEmpty()" ... |
6 posts
|
In reply to
this post by hadrian
Thanks! I don't have a test case yet. |
1074 posts
|
In reply to
this post by Tony Su
Tony,
I did reproduce your problem and created CAMEL-4976 [1]. I also added a unit test [2] that is consistent with your findings. It doesn'I am investigating a fix and I expect to have it committed by Monday. Enjoy the weekend, Hadrian [1] https://issues.apache.org/jira/browse/CAMEL-4976 [2] http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/RemoveEndpointsTest.java?view=markup On 02/03/2012 04:47 PM, Tony Su wrote: > Found a mistake in the original post: > > > Tony Su wrote >> >> if (removed != null) >> { >> logger.debug("EP not removed: {}", uri); >> } >> > > > This should be: > if (removed != null) > { > logger.debug("EP not removed: {}", uri); > } > Output is: > removing EP: jmsvm://topic:CORE_REQUEST_USRMGM > removing EP: jmsvm://topic:CORE_ADD_USRMGM > > This indicates that removeEndpoints should have succeeded, but an > examination of the context indicates that the endpoint is still present. > Using context.AddRoutes() to add routes with the same endpoints results in > duplicate endpoints present in the context. > > -- > View this message in context: http://camel.465427.n5.nabble.com/Problem-Removing-Endpoints-tp5455029p5455127.html > Sent from the Camel - Users mailing list archive at Nabble.com.
... [
show rest of quote]
-- Hadrian Zbarcea Principal Software Architect Talend, Inc http://coders.talend.com/ http://camelbot.blogspot.com/ |
6 posts
|
Thanks! I just noticed that you fixed the issue.
|
«
Return to Camel - Users |
209 views
Powered by Nabble | Edit this page |