use of org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclarer in project mule by mulesoft.
the class MuleExtensionModelDeclarer method declareIdempotentValidator.
private void declareIdempotentValidator(ExtensionDeclarer extensionDeclarer, ClassTypeLoader typeLoader) {
OperationDeclarer validator = extensionDeclarer.withOperation("idempotentMessageValidator").describedAs("Ensures that only unique messages are received by a service by checking the unique ID of the incoming message. " + "Note that the ID used can be generated from the message using an expression defined in the 'idExpression' " + "attribute. Otherwise, a 'DUPLICATE_MESSAGE' error is generated.");
validator.withOutput().ofType(typeLoader.load(void.class));
validator.withOutputAttributes().ofType(typeLoader.load(void.class));
validator.onDefaultParameterGroup().withOptionalParameter("idExpression").ofType(typeLoader.load(String.class)).defaultingTo("#[id]").withDsl(ParameterDslConfiguration.builder().allowsReferences(false).build()).describedAs("Defines one or more expressions to use when extracting the ID from the message. " + "If this property is not set, '#[id]' will be used by default.");
validator.onDefaultParameterGroup().withOptionalParameter("valueExpression").ofType(typeLoader.load(String.class)).defaultingTo("#[id]").describedAs("Defines one or more expressions to use when extracting the value from the message.");
validator.onDefaultParameterGroup().withOptionalParameter("storePrefix").ofType(typeLoader.load(String.class)).withExpressionSupport(NOT_SUPPORTED).describedAs("Defines the prefix of the object store names. This will only be used for the internally built object store.");
validator.onDefaultParameterGroup().withOptionalParameter("objectStore").withDsl(ParameterDslConfiguration.builder().allowsInlineDefinition(true).allowsReferences(true).build()).ofType(typeLoader.load(ObjectStore.class)).withExpressionSupport(NOT_SUPPORTED).withAllowedStereotypes(singletonList(OBJECT_STORE)).describedAs("The object store where the IDs of the processed events are going to be stored. " + "If defined as an argument, it should reference a globally created object store. Otherwise, " + "it can be defined inline or not at all. In the last case, a default object store will be provided.");
validator.withErrorModel(duplicateMessageError);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclarer in project mule by mulesoft.
the class MuleExtensionModelDeclarer method declareFlowRef.
private void declareFlowRef(ExtensionDeclarer extensionDeclarer, ClassTypeLoader typeLoader) {
OperationDeclarer flowRef = extensionDeclarer.withOperation("flowRef").describedAs("Allows a \u0027flow\u0027 to be referenced so that message processing will continue in the referenced flow " + "before returning. Message processing in the referenced \u0027flow\u0027 will occur within the context of the " + "referenced flow and will therefore use its exception strategy, etc.").withErrorModel(routingError);
flowRef.withOutput().ofType(BaseTypeBuilder.create(JAVA).anyType().build());
flowRef.withOutputAttributes().ofType(BaseTypeBuilder.create(JAVA).anyType().build());
flowRef.onDefaultParameterGroup().withRequiredParameter("name").ofType(typeLoader.load(String.class)).withExpressionSupport(NOT_SUPPORTED).describedAs("The name of the flow to call");
}
use of org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclarer in project mule by mulesoft.
the class MuleExtensionModelDeclarer method declareLogger.
private void declareLogger(ExtensionDeclarer extensionDeclarer, ClassTypeLoader typeLoader) {
OperationDeclarer logger = extensionDeclarer.withOperation("logger").describedAs("Performs logging using an expression to determine the message to be logged. By default, if a message is not specified, the current Mule Message is logged " + "using the " + DEFAULT_LOG_LEVEL + " level with the \u0027org.mule.runtime.core.api.processor.LoggerMessageProcessor\u0027 category, but " + "the level and category can both be configured to suit your needs.");
logger.withOutput().ofType(typeLoader.load(void.class));
logger.withOutputAttributes().ofType(typeLoader.load(void.class));
logger.onDefaultParameterGroup().withOptionalParameter("message").ofType(typeLoader.load(String.class)).describedAs("The message that will be logged. Embedded expressions can be used to extract values from the current message. " + "If no message is specified, then the current message is used.");
logger.onDefaultParameterGroup().withOptionalParameter("level").defaultingTo(DEFAULT_LOG_LEVEL).ofType(BaseTypeBuilder.create(JAVA).stringType().enumOf("ERROR", "WARN", "INFO", "DEBUG", "TRACE").build()).withExpressionSupport(NOT_SUPPORTED).describedAs("Sets the log level. Default is " + DEFAULT_LOG_LEVEL + ".");
logger.onDefaultParameterGroup().withOptionalParameter("category").ofType(typeLoader.load(String.class)).withExpressionSupport(NOT_SUPPORTED).describedAs("Sets the log category");
}
use of org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclarer in project mule by mulesoft.
the class MuleExtensionModelDeclarer method declareRemoveVariable.
private void declareRemoveVariable(ExtensionDeclarer extensionDeclarer, ClassTypeLoader typeLoader) {
OperationDeclarer removeVariable = extensionDeclarer.withOperation("removeVariable").describedAs("A processor that removes variables by name or regular expression.");
removeVariable.withOutput().ofType(typeLoader.load(void.class));
removeVariable.withOutputAttributes().ofType(typeLoader.load(void.class));
removeVariable.onDefaultParameterGroup().withOptionalParameter("variableName").ofType(typeLoader.load(String.class)).withExpressionSupport(NOT_SUPPORTED).describedAs("The variable name.");
}
use of org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclarer in project mule by mulesoft.
the class SoapInvokeOperationDeclarer method declare.
/**
* Declares the invoke operation.
*
* @param configDeclarer the soap config declarer
* @param loader a {@link ClassTypeLoader} to load some parameters types.
* @param soapErrors the {@link ErrorModel}s that this operation can throw.
*/
void declare(ConfigurationDeclarer configDeclarer, ClassTypeLoader loader, Set<ErrorModel> soapErrors) {
ReflectionCache reflectionCache = new ReflectionCache();
OperationDeclarer operation = configDeclarer.withOperation(OPERATION_NAME).describedAs(OPERATION_DESCRIPTION).requiresConnection(true).blocking(true).withModelProperty(new ComponentExecutorModelProperty(new SoapOperationExecutorFactory())).withModelProperty(new ConnectivityModelProperty(ForwardingSoapClient.class));
soapErrors.forEach(operation::withErrorModel);
declareMetadata(operation, loader);
declareOutput(operation, loader);
declareMetadataKeyParameters(operation, loader, reflectionCache);
declareRequestParameters(operation, loader);
}
Aggregations