Skip to content

Commit

Permalink
[Issue apache#417] update Grpc Message Model name to SimpleMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
jinrongluo authored and xwm1992 committed Feb 16, 2022
1 parent 153c52e commit 08a9c55
Show file tree
Hide file tree
Showing 35 changed files with 267 additions and 309 deletions.
8 changes: 4 additions & 4 deletions docs/cn/instructions/eventmesh-runtime-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ message RequestHeader {
string protocolDesc = 12;
}
message EventMeshMessage {
message SimpleMessage {
RequestHeader header = 1;
string producerGroup = 2;
string topic = 3;
Expand Down Expand Up @@ -388,10 +388,10 @@ message Heartbeat {
```
service PublisherService {
# 异步事件生产
rpc publish(EventMeshMessage) returns (Response);
rpc publish(SimpleMessage) returns (Response);
# 同步事件生产
rpc requestReply(EventMeshMessage) returns (Response);
rpc requestReply(SimpleMessage) returns (Response);
# 批量事件生产
rpc batchPublish(BatchMessage) returns (Response);
Expand All @@ -406,7 +406,7 @@ service ConsumerService {
rpc subscribe(Subscription) returns (Response);
# 所消费事件通过 TCP stream推送事件
rpc subscribeStream(Subscription) returns (stream EventMeshMessage);
rpc subscribeStream(Subscription) returns (stream SimpleMessage);
rpc unsubscribe(Subscription) returns (Response);
}
Expand Down
8 changes: 4 additions & 4 deletions docs/en/instructions/eventmesh-runtime-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ message RequestHeader {
string protocolDesc = 12;
}
message EventMeshMessage {
message SimpleMessage {
RequestHeader header = 1;
string producerGroup = 2;
string topic = 3;
Expand Down Expand Up @@ -391,10 +391,10 @@ message Heartbeat {
```
service PublisherService {
# Async event publish
rpc publish(EventMeshMessage) returns (Response);
rpc publish(SimpleMessage) returns (Response);
# Sync event publish
rpc requestReply(EventMeshMessage) returns (Response);
rpc requestReply(SimpleMessage) returns (Response);
# Batch event publish
rpc batchPublish(BatchMessage) returns (Response);
Expand All @@ -409,7 +409,7 @@ service ConsumerService {
rpc subscribe(Subscription) returns (Response);
# The subscribed event will be delivered through stream of Message
rpc subscribeStream(Subscription) returns (stream EventMeshMessage);
rpc subscribeStream(Subscription) returns (stream SimpleMessage);
rpc unsubscribe(Subscription) returns (Response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
package org.apache.eventmesh.common.protocol.grpc.common;

import org.apache.eventmesh.common.protocol.ProtocolTransportObject;
import org.apache.eventmesh.common.protocol.grpc.protos.EventMeshMessage;
import org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage;

public class EventMeshMessageWrapper implements ProtocolTransportObject {
public class SimpleMessageWrapper implements ProtocolTransportObject {

private EventMeshMessage eventMeshMessage;
private SimpleMessage simpleMessage;

public EventMeshMessageWrapper(EventMeshMessage eventMeshMessage) {
this.eventMeshMessage = eventMeshMessage;
public SimpleMessageWrapper(SimpleMessage simpleMessage) {
this.simpleMessage = simpleMessage;
}

public EventMeshMessage getMessage() {
return eventMeshMessage;
public SimpleMessage getMessage() {
return simpleMessage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,29 @@ Response> getSubscribeMethod() {
}

private static volatile io.grpc.MethodDescriptor<Subscription,
EventMeshMessage> getSubscribeStreamMethod;
org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage> getSubscribeStreamMethod;

@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "subscribeStream",
requestType = Subscription.class,
responseType = EventMeshMessage.class,
responseType = org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage.class,
methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
public static io.grpc.MethodDescriptor<Subscription,
EventMeshMessage> getSubscribeStreamMethod() {
io.grpc.MethodDescriptor<Subscription, EventMeshMessage> getSubscribeStreamMethod;
org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage> getSubscribeStreamMethod() {
io.grpc.MethodDescriptor<Subscription, org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage> getSubscribeStreamMethod;
if ((getSubscribeStreamMethod = ConsumerServiceGrpc.getSubscribeStreamMethod) == null) {
synchronized (ConsumerServiceGrpc.class) {
if ((getSubscribeStreamMethod = ConsumerServiceGrpc.getSubscribeStreamMethod) == null) {
ConsumerServiceGrpc.getSubscribeStreamMethod = getSubscribeStreamMethod =
io.grpc.MethodDescriptor.<Subscription, EventMeshMessage>newBuilder()
io.grpc.MethodDescriptor.<Subscription, org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
.setFullMethodName(generateFullMethodName(
"eventmesh.common.protocol.grpc.ConsumerService", "subscribeStream"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
Subscription.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
EventMeshMessage.getDefaultInstance()))
org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage.getDefaultInstance()))
.setSchemaDescriptor(new ConsumerServiceMethodDescriptorSupplier("subscribeStream"))
.build();
}
Expand Down Expand Up @@ -172,7 +172,7 @@ public void subscribe(Subscription request,
/**
*/
public void subscribeStream(Subscription request,
io.grpc.stub.StreamObserver<EventMeshMessage> responseObserver) {
io.grpc.stub.StreamObserver<org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage> responseObserver) {
asyncUnimplementedUnaryCall(getSubscribeStreamMethod(), responseObserver);
}

Expand All @@ -197,7 +197,7 @@ public void unsubscribe(Subscription request,
asyncServerStreamingCall(
new MethodHandlers<
Subscription,
EventMeshMessage>(
org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage>(
this, METHODID_SUBSCRIBE_STREAM)))
.addMethod(
getUnsubscribeMethod(),
Expand Down Expand Up @@ -239,7 +239,7 @@ public void subscribe(Subscription request,
/**
*/
public void subscribeStream(Subscription request,
io.grpc.stub.StreamObserver<EventMeshMessage> responseObserver) {
io.grpc.stub.StreamObserver<org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage> responseObserver) {
asyncServerStreamingCall(
getChannel().newCall(getSubscribeStreamMethod(), getCallOptions()), request, responseObserver);
}
Expand Down Expand Up @@ -280,7 +280,7 @@ public Response subscribe(Subscription request) {

/**
*/
public java.util.Iterator<EventMeshMessage> subscribeStream(
public java.util.Iterator<org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage> subscribeStream(
Subscription request) {
return blockingServerStreamingCall(
getChannel(), getSubscribeStreamMethod(), getCallOptions(), request);
Expand Down Expand Up @@ -356,7 +356,7 @@ public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserv
break;
case METHODID_SUBSCRIBE_STREAM:
serviceImpl.subscribeStream((Subscription) request,
(io.grpc.stub.StreamObserver<EventMeshMessage>) responseObserver);
(io.grpc.stub.StreamObserver<org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage>) responseObserver);
break;
case METHODID_UNSUBSCRIBE:
serviceImpl.unsubscribe((Subscription) request,
Expand Down
Loading

0 comments on commit 08a9c55

Please sign in to comment.