This is actually reopening
CAMEL-9311, because DynamicRouterConcurrentPOJOTest that was added to reproduce it is still failing.
First I thought the test is just flaky due to its bad design: it was calling assertMockEndpointsSatisfied() without any synchronizations of the participating threads.
But fixing that by adding
and replacing assertMockEndpointsSatisfied() with some timeouted variant did not make the issue disappear.
The improved reproducer test can be seen in this branch: https://github.com/ppalaga/camel/commits/CAMEL-19487
Note that it is not always failing. On my machine, I see it failing like 1:10. Invoking it in a loop eventually leads to a failure:
The second commit https://github.com/ppalaga/camel/commits/CAMEL-19487 adds some debug output.
In case of failure it shows that one of the dynamic router instances sometimes sends one or more messages to the wrong endpoint.
Here is an example:
In this case the dynamic router instance attached to route a sends the message to mock:b.
I'd say that's a serious bug.
This is exactly what the original issue
CAMEL-9311 was about.
The issue does not occur when each route uses a different dynamic router type: when I copy MyDynamicRouterPojo as MyDynamicRouterPojoB and use it in the route b, then all works as expected.