Vijay Nandwana
Vijay Nandwana

Reputation: 2634

Get Body of MockEndpoint

How can I get the body of MockEndpoint?

@EndpointInject(uri = "mock:direct:end")
protected MockEndpoint endEndpoint;

endEndpoint.setExpectedMessageCount(1);
String test = (String)endEndpoint.getExchanges().get(0).getIn().getBody();

endEndpoint.getExchanges() returns empty list and throws ArrayIndexOutOfBoundsException. However, endEndpoint does get 1 message.

Upvotes: 0

Views: 823

Answers (1)

Souciance Eqdam Rashti
Souciance Eqdam Rashti

Reputation: 3191

You should get it after you send the message to that endpoint and not before. So, after template.send..

Upvotes: 2

Related Questions