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;
}
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);
}
Aggregations