...
Method | Description |
---|---|
from(endpointUri) | Matches only when Exchanges are incoming from that particular endpoint. The endpointUri can be a pattern, which is the same pattern matching used by Intercept. |
whenReceived(number) | Matches when X number or more messages has been received. |
whenDone(number) | Matches when X number or more messages is done. |
whenComplete(number) | Matches when X number or more messages is complete. |
whenFailed(number) | Matches when X number or more messages is failed. |
whenExactlyDone(number) | Matches when exactly X number of messages is done. |
whenExactlyComplete(number) | Matches when exactly X number of messages is complete. |
whenExactlyFailed(number) | Matches when exactly X number of messages is failed. |
whenAnyReceivedMatches(predicate) | Matches if any one of the received messages matched the Predicate. |
whenAllReceivedMatches(predicate) | Matches only when all of the received messages matched the Predicate. |
whenReceivedSatisfied(mock) | Matches if the Mock is satisfied for received messages. Is used for fine grained matching by setting the expectations on the Mock which already have a great library for doing so. |
whenReceivedNotSatisfied(mock) | Matches if the Mock is not satisfied for received messages. Is used for fine grained matching by setting the expectations on the Mock which already have a great library for doing so. |
whenDoneSatisfied whenSatisfied(mock) | Matches if the Mock is satisfied for messages done. Is used for fine grained matching by setting the expectations on the Mock which already have a great library for doing so. |
whenNotSatisfied whenDoneNotSatisfied(mock) | Matches if the Mock is not satisfied for messages done. Is used for fine grained matching by setting the expectations on the Mock which already have a great library for doing so. |
and | Appends an additional expressions using the and operator. |
or | Appends an additional expressions using the or operator. |
not | Appends an additional expressions using the not operator. |
...
Code Block |
---|
// lets use a mock to set the expressions as it got many great assertions for that // notice we use mock:assert which does NOT exist in the route, its just a pseudo name MockEndpoint mock = getMockEndpoint("mock:assert"); mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World", "Hi World"); NotifierBuilder notifier = new NotifierBuilder(context) .from("direct:foo").whenSatisfiedwhenReceivedSatisfied(mock) .create(); |
Now it bring powers to the table. We combine a mock with the builder. We use the mock to set fine grained expectations such as we should receive 3 messages in any order. Then using the builder we can tell that those messages should be received from the direct:foo
endpoint.
...