I use Spring cloud stream with kafka stream to do some processing and somewhere in the middle of the processing I need to save the intermediate result to DB via Hibernate (Spring data jpa).
1.Should the data base call be async and to continue with the stream processing? 2. regardless of calling db sync or asyc how to handle error? say for example I doing some query in the middle of the (kafka stream) process and exception in thrown so rollback to db transaction occurs, can I aslo make "revert" the message that cause the exception in the middle of the process and try again? or is there any pattern that deals with it?