use of org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter in project mule by mulesoft.
the class DefaultMessageProcessorChainTestCase method testNestedResponseProcessorEndOfChain.
@Test
public void testNestedResponseProcessorEndOfChain() throws Exception {
DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
final MessageProcessorChain chain = newChain(empty(), singletonList(getAppendingMP("1")));
final ResponseMessageProcessorAdapter responseMessageProcessorAdapter = new ResponseMessageProcessorAdapter(chain);
responseMessageProcessorAdapter.setMuleContext(muleContext);
builder.chain(responseMessageProcessorAdapter);
process(builder.build(), getTestEventUsingFlow("0"));
assertThat(process(builder.build(), getTestEventUsingFlow("0")).getMessage().getPayload().getValue(), equalTo("01"));
}
use of org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter in project mule by mulesoft.
the class ResponseMessageProcessorsFactoryBean method doGetObject.
@Override
public ResponseMessageProcessorAdapter doGetObject() throws Exception {
DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
builder.setName("'response' child processor chain");
for (Object processor : messageProcessors) {
if (processor instanceof Processor) {
builder.chain((Processor) processor);
} else if (processor instanceof MessageProcessorBuilder) {
builder.chain((MessageProcessorBuilder) processor);
} else {
throw new IllegalArgumentException("MessageProcessorBuilder should only have MessageProcessor's or MessageProcessorBuilder's configured");
}
}
ResponseMessageProcessorAdapter responseAdapter = new ResponseMessageProcessorAdapter();
responseAdapter.setProcessor(newLazyProcessorChainBuilder(builder, muleContext, () -> getProcessingStrategy(locator, getRootContainerLocation()).orElse(null)));
responseAdapter.setMuleContext(muleContext);
return responseAdapter;
}
Aggregations