You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2022/02/02 03:33:26 UTC

[GitHub] [incubator-eventmesh] xwm1992 commented on a change in pull request #723: [Issue #718] update Grpc Message Model name to SimpleMessage

xwm1992 commented on a change in pull request #723:
URL: https://github.com/apache/incubator-eventmesh/pull/723#discussion_r797241077



##########
File path: eventmesh-examples/src/main/java/org/apache/eventmesh/grpc/sub/CloudEventsSubscribeReply.java
##########
@@ -0,0 +1,69 @@
+package org.apache.eventmesh.grpc.sub;
+
+import io.cloudevents.CloudEvent;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.eventmesh.client.grpc.config.EventMeshGrpcClientConfig;
+import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer;
+import org.apache.eventmesh.client.grpc.consumer.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.common.protocol.SubscriptionItem;
+import org.apache.eventmesh.common.protocol.SubscriptionMode;
+import org.apache.eventmesh.common.protocol.SubscriptionType;
+import org.apache.eventmesh.util.Utils;
+
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Properties;
+
+@Slf4j
+public class CloudEventsSubscribeReply implements ReceiveMsgHook<CloudEvent> {
+
+    public static CloudEventsSubscribeReply handler = new CloudEventsSubscribeReply();
+
+    public static void main(String[] args) throws InterruptedException {
+        Properties properties = Utils.readPropertiesFile("application.properties");
+        final String eventMeshIp = properties.getProperty("eventmesh.ip");
+        final String eventMeshGrpcPort = properties.getProperty("eventmesh.grpc.port");
+
+        final String topic = "TEST-TOPIC-GRPC-RR";
+
+        EventMeshGrpcClientConfig eventMeshClientConfig = EventMeshGrpcClientConfig.builder()
+            .serverAddr(eventMeshIp)
+            .serverPort(Integer.parseInt(eventMeshGrpcPort))
+            .consumerGroup("EventMeshTest-consumerGroup")
+            .env("env").idc("idc")
+            .sys("1234").build();
+
+        SubscriptionItem subscriptionItem = new SubscriptionItem();
+        subscriptionItem.setTopic(topic);
+        subscriptionItem.setMode(SubscriptionMode.CLUSTERING);
+        subscriptionItem.setType(SubscriptionType.ASYNC);

Review comment:
       this should be `subscriptionItem.setType(SubscriptionType.SYNC)`, because this is request-reply mode.

##########
File path: eventmesh-examples/src/main/java/org/apache/eventmesh/grpc/sub/EventmeshSubscribeReply.java
##########
@@ -0,0 +1,68 @@
+package org.apache.eventmesh.grpc.sub;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.eventmesh.client.grpc.config.EventMeshGrpcClientConfig;
+import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer;
+import org.apache.eventmesh.client.grpc.consumer.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.common.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.SubscriptionItem;
+import org.apache.eventmesh.common.protocol.SubscriptionMode;
+import org.apache.eventmesh.common.protocol.SubscriptionType;
+import org.apache.eventmesh.util.Utils;
+
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Properties;
+
+@Slf4j
+public class EventmeshSubscribeReply implements ReceiveMsgHook<EventMeshMessage> {
+
+    public static EventmeshSubscribeReply handler = new EventmeshSubscribeReply();
+
+    public static void main(String[] args) throws InterruptedException {
+        Properties properties = Utils.readPropertiesFile("application.properties");
+        final String eventMeshIp = properties.getProperty("eventmesh.ip");
+        final String eventMeshGrpcPort = properties.getProperty("eventmesh.grpc.port");
+
+        final String topic = "TEST-TOPIC-GRPC-RR";
+
+        EventMeshGrpcClientConfig eventMeshClientConfig = EventMeshGrpcClientConfig.builder()
+            .serverAddr(eventMeshIp)
+            .serverPort(Integer.parseInt(eventMeshGrpcPort))
+            .consumerGroup("EventMeshTest-consumerGroup")
+            .env("env").idc("idc")
+            .sys("1234").build();
+
+        SubscriptionItem subscriptionItem = new SubscriptionItem();
+        subscriptionItem.setTopic(topic);
+        subscriptionItem.setMode(SubscriptionMode.CLUSTERING);
+        subscriptionItem.setType(SubscriptionType.ASYNC);

Review comment:
       this should be `subscriptionItem.setType(SubscriptionType.SYNC)`




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

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org