WillemJiang 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_r349960419
 
 

 ##########
 File path: 
alpha/alpha-server/src/main/java/org/apache/servicecomb/pack/alpha/server/GrpcTxEventEndpointImpl.java
 ##########
 @@ -56,10 +60,29 @@
   }
 
   @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>() {
+      @Override
+      public void onNext(GrpcServiceConfig grpcServiceConfig) {
+        omegaCallbacks
+            .computeIfAbsent(grpcServiceConfig.getServiceName(), key -> new 
ConcurrentHashMap<>())
+            .put(grpcServiceConfig.getInstanceId(), new 
GrpcOmegaCallback(responseObserver));
+        // Respond to Omega connection request
+        responseObserver.onNext(GrpcCompensateCommand.newBuilder()
+            .setConnectedResponse(true)
+            .build());
+      }
+
+      @Override
+      public void onError(Throwable throwable) {
+        LOG.error(throwable.getMessage());
+      }
+
+      @Override
+      public void onCompleted() {
+        // Do nothing here
 
 Review comment:
   I think we need to add some log here.

----------------------------------------------------------------
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

Reply via email to