sudhanshu_tiw3212
sudhanshu_tiw3212

Reputation: 1

Is it possible to send List of CloudEventMessage as response of Spring cloud function triggered by knative trigger?

I am new to knative eventing. I am working with spring cloud functions that are triggered by knative triggers. Now if I am returning single CloudEventMessage from my function it is getting put into the source kafka broker. But my usecase requires me to publish n number of events. So, I tried sending a List as response, but this is flooding my kafka broker with empty list response. I want each CloudEventMessage in my list to be populated in the broker as separate event.

Is it possible to send multiple events from function triggered by knative trigger ? If yes, what is the correct way to do that.

My cloud function signature that is putting message back to source broker is:

public Function<Message < String>, Message < DemoEvents> > getDemoEvents()

I have tried changing my method to send a list of Message in response:

public Function<Message < String>, List<Message < DemoEvents> >> getDemoEvents()

But this is not working as expected as mentioned above.

I want each event in the response list to be published as individual event. Also if someone could explain how exactly broker and trigger model of knative eventing put response of subscriber service back to the source broker it will be really helpful.

Upvotes: 0

Views: 32

Answers (0)

Related Questions