First time using the custom router function which would act as a filter as mentioned in the docs here and I was wondering, who do I redirect the input to?
In the past I had only the consumer which is declared as follows:
@Bean
public Consumer<Message<MyClass<T>>> myFunction() {
return ...;
}
Together with the properties set as:
spring:
cloud:
stream:
bindings:
myFunction-in-0: "input"
input:
destination: "my-kinesis"
binder: kinesis
group: "my-group"
But now, having a custom router declared, I'm confused if that is still the proper input as myFunction-in-0
.
The custom router function returns the following FunctionRoutingResult
:
return new MessageRoutingCallback.FunctionRoutingResult(
myCondition ? "myFunction" : "devNull"
);
Also, added the devNull
sink for cases where the condition is not met.
@Bean
public Consumer<Message<MyClass<?>>> devNull() {
return ...;
}
EDIT: the error thrown is as follows:
Failed to bind properties under 'spring.cloud.stream.bindings.myfunction-in-0' to org.springframework.cloud.stream.config.BindingProperties:
Reason: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [org.springframework.cloud.stream.config.BindingProperties]
Action:
Update your application's configuration
spring-cloud-stream
version: 3.2.4
spring-boot-starter-parent
version: 2.6.6
spring-cloud-dependencies
version: 2021.0.3
Could it be the generics in the received message? Can it be automatically parsed into the POJO?