Search in sources :

Example 1 with OperationMessageProcessorBuilder

use of org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessorBuilder 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);
    }
}
Also used : OperationMessageProcessorBuilder(org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessorBuilder) ConfigurationProvider(org.mule.runtime.extension.api.runtime.config.ConfigurationProvider) StaticValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.StaticValueResolver) ValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ValueResolver) ExpressionValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ExpressionValueResolver) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) OperationMessageProcessor(org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessor) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) MuleException(org.mule.runtime.api.exception.MuleException) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) ExecutionException(java.util.concurrent.ExecutionException) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 MuleException (org.mule.runtime.api.exception.MuleException)1 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)1 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)1 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)1 OperationModel (org.mule.runtime.api.meta.model.operation.OperationModel)1 ConfigurationProvider (org.mule.runtime.extension.api.runtime.config.ConfigurationProvider)1 OperationMessageProcessor (org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessor)1 OperationMessageProcessorBuilder (org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessorBuilder)1 ExpressionValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.ExpressionValueResolver)1 StaticValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.StaticValueResolver)1 ValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.ValueResolver)1