Closed
Description
I have already found some discussion around @transactional in #41. Now I stumbled across an issue in my integration tests where the transaction is not committed yet but the gRPC call already returned. I'd like to help to contribute to this issue but I am missing some understanding of both the gRPC lifecycle of calls and the mechanism of dynamic proxies in Spring. Below an example of such a unit/integration test.
@Transactional
public void rpcCall(Req request, StreamOvserver<Res> observer) {
// Database operations via JPARepositories
observer.onNext(response);
observer.onCompleted();
}
@Test
public void unitTest() {
stub.rpcCall(request);
// DB check if data is written.. sometimes changes are not yet committed in DB
}
My potential solution to this issue is to simple delay the calls to onNext, onError and onCompleted after the transaction is committed. This solution would only work for non streaming rpc calls. Any thoughts about this one?
Metadata
Metadata
Assignees
Labels
No labels