Search in sources :

Example 1 with ConstructDeclarer

use of org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer in project mule by mulesoft.

the class MuleExtensionModelDeclarer method declareSplitAggregate.

private void declareSplitAggregate(ExtensionDeclarer extensionDeclarer, ClassTypeLoader typeLoader) {
    ConstructDeclarer splitAggregate = extensionDeclarer.withConstruct("splitAggregate").describedAs("Splits the same message and processes each part in parallel.").withErrorModel(compositeRoutingError);
    splitAggregate.withChain();
    splitAggregate.onDefaultParameterGroup().withOptionalParameter("collection").ofType(typeLoader.load(String.class)).withRole(ParameterRole.BEHAVIOUR).withExpressionSupport(REQUIRED).describedAs("Expression that defines the collection of parts to be processed in parallel");
    splitAggregate.onDefaultParameterGroup().withOptionalParameter("timeout").ofType(typeLoader.load(Long.class)).defaultingTo(Long.MAX_VALUE).withExpressionSupport(NOT_SUPPORTED).describedAs("Sets a timeout in milliseconds for each route. Values lower or equals than zero means no timeout.");
    splitAggregate.onDefaultParameterGroup().withOptionalParameter("maxConcurrency").ofType(typeLoader.load(Integer.class)).defaultingTo(Integer.MAX_VALUE).withExpressionSupport(NOT_SUPPORTED).describedAs("This value determines the maximum level of parallelism that will be used by this router.");
    splitAggregate.onDefaultParameterGroup().withOptionalParameter(TARGET_PARAMETER_NAME).ofType(typeLoader.load(String.class)).withExpressionSupport(NOT_SUPPORTED).describedAs(TARGET_PARAMETER_DESCRIPTION).withLayout(LayoutModel.builder().tabName(ADVANCED_TAB).build());
    splitAggregate.onDefaultParameterGroup().withOptionalParameter(TARGET_VALUE_PARAMETER_NAME).ofType(typeLoader.load(String.class)).defaultingTo(PAYLOAD).withExpressionSupport(REQUIRED).describedAs(TARGET_VALUE_PARAMETER_DESCRIPTION).withRole(BEHAVIOUR).withDisplayModel(DisplayModel.builder().displayName(TARGET_VALUE_PARAMETER_DISPLAY_NAME).build()).withLayout(LayoutModel.builder().tabName(ADVANCED_TAB).build()).withModelProperty(new TargetModelProperty());
}
Also used : ConstructDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer) TargetModelProperty(org.mule.runtime.extension.internal.property.TargetModelProperty)

Example 2 with ConstructDeclarer

use of org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer in project mule by mulesoft.

the class MuleExtensionModelDeclarer method declareConfiguration.

private void declareConfiguration(ExtensionDeclarer extensionDeclarer, ClassTypeLoader typeLoader) {
    ConstructDeclarer configuration = extensionDeclarer.withConstruct("configuration").allowingTopLevelDefinition().withStereotype(APP_CONFIG).describedAs("Specifies defaults and general settings for the Mule instance.");
    addReconnectionStrategyParameter(configuration.getDeclaration());
    configuration.onDefaultParameterGroup().withOptionalParameter("defaultResponseTimeout").ofType(typeLoader.load(String.class)).withExpressionSupport(NOT_SUPPORTED).defaultingTo("10000").describedAs("The default period (ms) to wait for a synchronous response.");
    configuration.onDefaultParameterGroup().withOptionalParameter("defaultTransactionTimeout").ofType(typeLoader.load(String.class)).withExpressionSupport(NOT_SUPPORTED).defaultingTo("30000").describedAs("The default timeout (ms) for transactions. This can also be configured on transactions, " + "in which case the transaction configuration is used instead of this default.");
    configuration.onDefaultParameterGroup().withOptionalParameter("defaultErrorHandler-ref").ofType(typeLoader.load(String.class)).withExpressionSupport(NOT_SUPPORTED).describedAs("The default error handler for every flow. This must be a reference to a global error handler.");
    configuration.onDefaultParameterGroup().withOptionalParameter("shutdownTimeout").ofType(typeLoader.load(Integer.class)).withExpressionSupport(NOT_SUPPORTED).defaultingTo("5000").describedAs("The time in milliseconds to wait for any in-progress work to finish running before Mule shuts down. " + "After this threshold has been reached, Mule starts stopping schedulers and interrupting threads, " + "and messages can be lost. If you have a very large number of services in the same Mule instance, " + "if you have components that take more than a couple seconds to process, or if you are using large " + "payloads and/or slower transports, you should increase this value to allow more time for graceful shutdown." + " The value you specify is applied to services and separately to dispatchers, so the default value of " + "5000 milliseconds specifies that Mule has ten seconds to process and dispatch messages gracefully after " + "shutdown is initiated.");
    configuration.onDefaultParameterGroup().withOptionalParameter("maxQueueTransactionFilesSize").ofType(typeLoader.load(Integer.class)).withExpressionSupport(NOT_SUPPORTED).defaultingTo("500").describedAs("Sets the approximate maximum space in megabytes allowed for the transaction log files for transactional persistent queues." + " Take into account that this number applies both to the set of transaction log files for XA and for local transactions. " + "If both types of transactions are used then the approximate maximum space used, will be twice the configured value.");
    configuration.onDefaultParameterGroup().withOptionalParameter("defaultObjectSerializer-ref").ofType(typeLoader.load(String.class)).withExpressionSupport(NOT_SUPPORTED).describedAs("An optional reference to an ObjectSerializer to be used as the application's default");
    configuration.onDefaultParameterGroup().withOptionalParameter("dynamicConfigExpiration").describedAs(DYNAMIC_CONFIG_EXPIRATION_DESCRIPTION).ofType(new DynamicConfigExpirationTypeBuilder().buildDynamicConfigExpirationType()).withExpressionSupport(NOT_SUPPORTED).withDsl(ParameterDslConfiguration.builder().allowsReferences(false).allowsInlineDefinition(true).allowTopLevelDefinition(false).build());
}
Also used : ConstructDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer) DynamicConfigExpirationTypeBuilder(org.mule.runtime.extension.api.declaration.type.DynamicConfigExpirationTypeBuilder)

Example 3 with ConstructDeclarer

use of org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer in project mule by mulesoft.

the class MuleExtensionModelDeclarer method declareForEach.

private void declareForEach(ExtensionDeclarer extensionDeclarer, ClassTypeLoader typeLoader) {
    ConstructDeclarer forEach = extensionDeclarer.withConstruct("foreach").describedAs("The foreach Processor allows iterating over a collection payload, or any collection obtained by an expression," + " generating a message for each element.");
    forEach.withChain();
    forEach.onDefaultParameterGroup().withOptionalParameter("collection").ofType(typeLoader.load(new TypeToken<Iterable<Object>>() {
    }.getType())).defaultingTo("#[payload]").withExpressionSupport(REQUIRED).describedAs("An expression to that returns a java collection, object array, map or DOM nodes.");
    forEach.onDefaultParameterGroup().withOptionalParameter("batchSize").ofType(typeLoader.load(Integer.class)).withExpressionSupport(NOT_SUPPORTED).describedAs("An expression to that returns a java collection, object array, map or DOM nodes.");
    forEach.onDefaultParameterGroup().withOptionalParameter("rootMessageVariableName").ofType(typeLoader.load(String.class)).defaultingTo("rootMessage").withExpressionSupport(NOT_SUPPORTED).describedAs("Property name where the parent message is stored.");
    forEach.onDefaultParameterGroup().withOptionalParameter("counterVariableName").ofType(typeLoader.load(String.class)).defaultingTo("counter").withExpressionSupport(NOT_SUPPORTED).describedAs("Property name used to store the number of message being iterated.");
}
Also used : ConstructDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer) TypeToken(com.google.gson.reflect.TypeToken)

Example 4 with ConstructDeclarer

use of org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer in project mule by mulesoft.

the class MuleExtensionModelDeclarer method declareChoice.

private void declareChoice(ExtensionDeclarer extensionDeclarer, ClassTypeLoader typeLoader) {
    ConstructDeclarer choice = extensionDeclarer.withConstruct("choice").describedAs("Sends the message to the first message processor whose condition has been satisfied. " + "If no conditions were satisfied, sends to the configured default message processor (if configured), " + "or throws an exception (if not configured).").withErrorModel(routingError);
    NestedRouteDeclarer when = choice.withRoute("when").withMinOccurs(1);
    when.withChain();
    when.onDefaultParameterGroup().withRequiredParameter("expression").ofType(typeLoader.load(boolean.class)).describedAs("The expression to evaluate.");
    choice.withRoute("otherwise").withMaxOccurs(1).withChain();
}
Also used : ConstructDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer) NestedRouteDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.NestedRouteDeclarer)

Example 5 with ConstructDeclarer

use of org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer in project mule by mulesoft.

the class MuleExtensionModelDeclarer method declareRoundRobin.

private void declareRoundRobin(ExtensionDeclarer extensionDeclarer) {
    ConstructDeclarer roundRobin = extensionDeclarer.withConstruct("roundRobin").describedAs("Send each message received to the next message processor in the circular list of targets.");
    roundRobin.withRoute("route").withChain();
}
Also used : ConstructDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer)

Aggregations

ConstructDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ConstructDeclarer)15 NestedRouteDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.NestedRouteDeclarer)3 TargetModelProperty (org.mule.runtime.extension.internal.property.TargetModelProperty)2 TypeToken (com.google.gson.reflect.TypeToken)1 String.format (java.lang.String.format)1 Method (java.lang.reflect.Method)1 Arrays.asList (java.util.Arrays.asList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Collectors.toList (java.util.stream.Collectors.toList)1 Declarer (org.mule.runtime.api.meta.model.declaration.fluent.Declarer)1 ExtensionDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer)1 HasConstructDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.HasConstructDeclarer)1 HasOperationDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.HasOperationDeclarer)1 PathModel (org.mule.runtime.api.meta.model.display.PathModel)1 Parameter (org.mule.runtime.extension.api.annotation.param.Parameter)1 DynamicConfigExpirationTypeBuilder (org.mule.runtime.extension.api.declaration.type.DynamicConfigExpirationTypeBuilder)1 RouterCompletionCallback (org.mule.runtime.extension.api.runtime.process.RouterCompletionCallback)1