Search in sources :

Example 1 with BackPressureMode

use of org.mule.runtime.extension.api.runtime.source.BackPressureMode in project mule by mulesoft.

the class BackPressureStrategyModelProperty method of.

public static BackPressureStrategyModelProperty of(BackPressure annotation) {
    BackPressureStrategyModelProperty settings = new BackPressureStrategyModelProperty();
    settings.defaultMode = annotation.defaultMode();
    settings.supportedModes = new LinkedHashSet<>();
    for (BackPressureMode supported : annotation.supportedModes()) {
        settings.supportedModes.add(supported);
    }
    return settings;
}
Also used : BackPressureMode(org.mule.runtime.extension.api.runtime.source.BackPressureMode)

Example 2 with BackPressureMode

use of org.mule.runtime.extension.api.runtime.source.BackPressureMode in project mule by mulesoft.

the class BackPressureDeclarationEnricher method addBackPressureParameter.

private void addBackPressureParameter(ExtensionDeclaration extensionDeclaration, SourceDeclaration sourceDeclaration, BackPressureStrategyModelProperty property) {
    ParameterDeclaration parameter = new ParameterDeclaration(BACK_PRESSURE_STRATEGY_PARAMETER_NAME);
    parameter.setDescription(BACK_PRESSURE_STRATEGY_PARAMETER_DESCRIPTION);
    parameter.setRequired(false);
    parameter.setDefaultValue(property.getDefaultMode());
    parameter.setExpressionSupport(NOT_SUPPORTED);
    parameter.setLayoutModel(LayoutModel.builder().tabName(ADVANCED_TAB).build());
    MetadataType type = BaseTypeBuilder.create(JAVA).stringType().id(format("%s-%s-backPressureStrategy", extensionDeclaration.getName(), sourceDeclaration.getName())).with(new EnumAnnotation<>(property.getSupportedModes().stream().map(BackPressureMode::name).toArray(String[]::new))).build();
    parameter.setType(type, false);
    sourceDeclaration.getParameterGroup(DEFAULT_GROUP_NAME).addParameter(parameter);
}
Also used : EnumAnnotation(org.mule.metadata.api.annotation.EnumAnnotation) MetadataType(org.mule.metadata.api.model.MetadataType) BackPressureMode(org.mule.runtime.extension.api.runtime.source.BackPressureMode) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration)

Aggregations

BackPressureMode (org.mule.runtime.extension.api.runtime.source.BackPressureMode)2 EnumAnnotation (org.mule.metadata.api.annotation.EnumAnnotation)1 MetadataType (org.mule.metadata.api.model.MetadataType)1 ParameterDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration)1