use of org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessor in project mule by mulesoft.
the class DefaultExtensionsClient method createProcessor.
/**
* Creates a new {@link OperationMessageProcessor} for the required operation and parses all the parameters passed by the client
* user.
*/
private OperationMessageProcessor createProcessor(String extensionName, String operationName, OperationParameters parameters) {
ExtensionModel extension = findExtension(extensionName);
OperationModel operation = findOperation(extension, operationName);
ConfigurationProvider config = parameters.getConfigName().map(this::findConfiguration).orElse(null);
Map<String, ValueResolver> resolvedParams = resolveParameters(parameters.get(), getEvent());
try {
OperationMessageProcessor processor = new OperationMessageProcessorBuilder(extension, operation, policyManager, muleContext, registry).setConfigurationProvider(config).setParameters(resolvedParams).build();
initialiseIfNeeded(processor, muleContext);
processor.start();
return processor;
} catch (Exception e) {
throw new MuleRuntimeException(createStaticMessage("Could not create Operation Message Processor"), e);
}
}
use of org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessor in project mule by mulesoft.
the class DefaultExtensionsClient method executeAsync.
/**
* {@inheritDoc}
*/
@Override
public <T, A> CompletableFuture<Result<T, A>> executeAsync(String extension, String operation, OperationParameters parameters) {
OperationMessageProcessor processor = createProcessor(extension, operation, parameters);
Mono<Result<T, A>> resultMono = process(processor).map(event -> Result.<T, A>builder(event.getMessage()).build()).onErrorMap(Exceptions::unwrap).doAfterTerminate(() -> disposeProcessor(processor));
return resultMono.toFuture();
}
Aggregations