coolbeevip commented on a change in pull request #607: WIP [SCB-1577] Improve
the transaction compensation mechanism for FSM
URL: https://github.com/apache/servicecomb-pack/pull/607#discussion_r350008192
##########
File path:
alpha/alpha-server/src/main/java/org/apache/servicecomb/pack/alpha/server/fsm/GrpcSagaEventService.java
##########
@@ -54,11 +54,32 @@ public GrpcSagaEventService(ActorEventChannel
actorEventChannel,
}
@Override
- public void onConnected(
- GrpcServiceConfig request, StreamObserver<GrpcCompensateCommand>
responseObserver) {
- omegaCallbacks
- .computeIfAbsent(request.getServiceName(), key -> new
ConcurrentHashMap<>())
- .put(request.getInstanceId(), new GrpcOmegaCallback(responseObserver));
+ public StreamObserver<GrpcServiceConfig>
onConnected(StreamObserver<GrpcCompensateCommand> responseObserver) {
+ return new StreamObserver<GrpcServiceConfig>(){
+
+ private GrpcOmegaCallback grpcOmegaCallback;
+
+ @Override
+ public void onNext(GrpcServiceConfig grpcServiceConfig) {
+ grpcOmegaCallback = new GrpcOmegaCallback(responseObserver);
+ omegaCallbacks
+ .computeIfAbsent(grpcServiceConfig.getServiceName(), key -> new
ConcurrentHashMap<>())
+ .put(grpcServiceConfig.getInstanceId(), grpcOmegaCallback);
+ responseObserver.onNext(GrpcCompensateCommand.newBuilder()
+ .setConnectedResponse(true)
+ .build());
Review comment:
@WillemJiang Alpha sends a response message to Omega after receiving the
connection request.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services