You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by scottj <sc...@outlook.com> on 2013/03/21 15:07:29 UTC

inflight and pending exchanges during shutdown in a test

hello list,
I am trying to test a Router using the CamelSpringTestSupport with Camel
2.10.4 and ActiveMQ 5.8.0. My route is configured as follows

from("activemq:queue:incoming").multicast().to("direct:multicast");

from("direct:multicast")
.shutdownRoute(ShutdownRoute.Defer)
.shutdownRunningTask(ShutdownRunningTask.CompleteAllTasks)
.multicast().parallelProcessing().[...]
.bean(producer, "sendSearchRequest").end();

when using CamelSpringTestSupport, I have the following setup
@EndpointInject(uri = "mock:" + "direct:multicast")
private MockEndpoint multicastEndpointMock;

@Override
public String isMockEndpoints() {
    return "*"; 
}

The following test goes green
template.sendBody("activemq:queue:incoming", searchRequest);
multicastEndpointMock.expectedMessageCount(1);

but when the test is finished, I get the following message
[Camel (camel) thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are still 2
inflight and pending exchanges to complete, timeout in 10 seconds.
[main] WARN org.apache.camel.impl.DefaultShutdownStrategy - Timeout
occurred. Now forcing the routes to be shutdown now.
[Camel (camel) thread #2 - ShutdownTask] WARN
org.apache.camel.impl.DefaultShutdownStrategy - Interrupted while waiting
during graceful shutdown, will force shutdown now.

my questions are
1) why are there 2 inflight and pending exchanges? I believe I have one on
the mock:activemq:queue:incoming consumer and one on the
mock:direct:multicast consumer. Why are they not consumed?

2) how should I consume these exchanges?

anny hints would be highly appreciated!

cheers,
sj



--
View this message in context: http://camel.465427.n5.nabble.com/inflight-and-pending-exchanges-during-shutdown-in-a-test-tp5729620.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: inflight and pending exchanges during shutdown in a test

Posted by PJ Walstroem <wa...@hotmail.com>.
I think your solution, since you are using 2.10.4, is to use the
mockEndpointsAndSkip available in Camel 2.10 and onwards. When you mock
endpoints in previous versions, the original enpoints are still active; i.e.
both your mocks and your unmocked endpoints will receive the messages. I
guess that is the problem here; your unmocked enpoints are not able to
process the messages for some reason. 

Read more about it here: http://camel.apache.org/mock.html



--
View this message in context: http://camel.465427.n5.nabble.com/inflight-and-pending-exchanges-during-shutdown-in-a-test-tp5729620p5729635.html
Sent from the Camel - Users mailing list archive at Nabble.com.