Calling Hibernate in Spring cloud Stream

Viewed 43

I'm new to Spring cloud stream.

Say I Spring cloud stream app that listen to some topic from kafka using @StreamListener("input-channel").

I want to do some calculation and send the result to another topic but in the middle of the processing I also need to call Hibernate (via spring data jpa) to persist some data to my mySQL data base.

Is it valid to call Hibernate in the middle of stream processing? is there other pattern to do it?

1 Answers

Yes, it's a database call, so why not. People do it all the time.

Also, @StreamListener, has been deprecated for 3 years now, and is already removed from the new versions, so please transition to functional programming model

Related