// add another pre-processing action that changes the message
processorService.addPreProcessingAction(new Action() {
@Override
public void execute(Message message) throws Exception {
Message smsMessage = (Message) message;
smsMessage.setProperty("from", "1234");
}
});
// add a post-processing action
MockAction postProcessingAction = new MockAction();
processorService.addPostProcessingAction(postProcessingAction);
// add another post-processing action that changes the message
processorService.addPostProcessingAction(new Action() {
@Override
public void execute(Message message) throws Exception {
Message smsMessage = (Message) message;
smsMessage.setProperty("to", "1111");
}
});
processorService.start();
simulateMessage(new Message(), "activemq:mokai-test");
outboundEndpoint.assertIsSatisfied(DEFAULT_TIMEOUT);
failedEndpoint.assertIsSatisfied(DEFAULT_TIMEOUT);
Assert.assertEquals(1, processor.getCount());
Assert.assertEquals(1, preProcessingAction.getChanged());
Assert.assertEquals(1, postProcessingAction.getChanged());
Message message = (Message) processor.getMessage(0);
Assert.assertEquals("1234", message.getProperty("from", String.class));
Assert.assertEquals("1111", message.getProperty("to", String.class));
}