diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/BindableFunctionProxyFactory.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/BindableFunctionProxyFactory.java index 967a10795..97110c608 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/BindableFunctionProxyFactory.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/BindableFunctionProxyFactory.java @@ -41,8 +41,6 @@ import org.springframework.util.CollectionUtils; */ class BindableFunctionProxyFactory extends BindableProxyFactory { - static final String delimiter = "-"; - private final int inputCount; private final int outputCount; @@ -128,18 +126,18 @@ class BindableFunctionProxyFactory extends BindableProxyFactory { private String buildInputNameForIndex(int index) { return new StringBuilder(this.functionDefinition) - .append(delimiter) - .append("in") - .append(delimiter) + .append(FunctionConstants.DELIMITER) + .append(FunctionConstants.DEFAULT_INPUT_SUFFIX) + .append(FunctionConstants.DELIMITER) .append(index) .toString(); } private String buildOutputNameForIndex(int index) { return new StringBuilder(this.functionDefinition) - .append(delimiter) - .append("out") - .append(delimiter) + .append(FunctionConstants.DELIMITER) + .append(FunctionConstants.DEFAULT_OUTPUT_SUFFIX) + .append(FunctionConstants.DELIMITER) .append(index) .toString(); } diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/FunctionConstants.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/FunctionConstants.java new file mode 100644 index 000000000..74180db3b --- /dev/null +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/FunctionConstants.java @@ -0,0 +1,49 @@ +/* + * Copyright 2019-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.stream.function; + +/** + * Interfaces which defines constants used for naming conventions used in bindings + * of multiple functions or functions with multiple inputs and outputs. + * + * @author Oleg Zhurakousky + * @author Soby Chacko + * + * @since 3.0 + * + */ +public final class FunctionConstants { + + private FunctionConstants() { + + } + + /** + * Delimiter used for functional binding naming convention. + */ + public static final String DELIMITER = "-"; + + /** + * Suffix used for functional binding naming convention. + */ + public static final String DEFAULT_OUTPUT_SUFFIX = "out"; + + /** + * Prefix used for functional binding naming convention. + */ + public static final String DEFAULT_INPUT_SUFFIX = "in"; +}