Master Mind Master Mind - 1 year ago 247
Java Question

spring cloud stream kafka : Duplicate @StreamListener mapping for 'input'

I have a producer (

) that writes messages to a Kafka output channel , that producer sends different type of objects. On the consumer side (
) I want to have multiple
methods on the same input channel each method with a different parameter type and currently it is not working I get
Duplicate @StreamListener mapping for 'input'

Here is my consumer code :

public void on(PostUpvotedEvent event) {


public void on(PostDownvotedEvent event) {


Is there a better solution to do that than having a single
method which will test on the message type to choose which method to be called ?

Answer Source

Multiple @StreamListener methods on the same bound element are not supported now. It will be good to support this like in your case to register multiple subscribers on the inbound channel.

Please create a feature request here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download