Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected Exchange configureExchange(Exchange exchange, ExchangePattern pattern)
// invoke on prepare on the exchange if specified
if (onPrepare != null) {
try {
onPrepare.process(exchange);
onPrepare.process(answer);
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ public void testWireTapOnPrepare() throws Exception {
getMockEndpoint("mock:b").expectedMessageCount(1);
getMockEndpoint("mock:b").message(0).body(String.class).isEqualTo("1 Tiger");

template.sendBody("direct:start", new Animal(1, "Tiger"));
final Animal original = new Animal(1, "Tiger");
template.sendBody("direct:start", original);

assertMockEndpointsSatisfied();

final Animal aAnimal = getMockEndpoint("mock:a").getExchanges().get(0).getIn().getBody(Animal.class);
final Animal bAnimal = getMockEndpoint("mock:b").getExchanges().get(0).getIn().getBody(Animal.class);

assertSame("Original instance should stay in main route", original, bAnimal);
assertNotSame("Copy should go to Wire Tap Endpoint", original, aAnimal);
}

@Override
Expand Down