From ec1f9266d2bcd95c9ac41e049d15fec20c9d4afa Mon Sep 17 00:00:00 2001 From: qqeasonchen Date: Wed, 18 Sep 2019 10:48:15 +0800 Subject: [PATCH] optimize request/response examples --- .../apache/rocketmq/example/rpc/AsyncRequestProducer.java | 5 ++--- .../org/apache/rocketmq/example/rpc/RequestProducer.java | 4 +--- .../org/apache/rocketmq/example/rpc/ResponseConsumer.java | 4 +--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/example/src/main/java/org/apache/rocketmq/example/rpc/AsyncRequestProducer.java b/example/src/main/java/org/apache/rocketmq/example/rpc/AsyncRequestProducer.java index d2475c16..072291d5 100644 --- a/example/src/main/java/org/apache/rocketmq/example/rpc/AsyncRequestProducer.java +++ b/example/src/main/java/org/apache/rocketmq/example/rpc/AsyncRequestProducer.java @@ -29,13 +29,11 @@ public class AsyncRequestProducer { private static final InternalLogger log = ClientLogger.getLog(); public static void main(String[] args) throws MQClientException, InterruptedException { - String producerGroup = "ProducerGroup-Name"; - String namesrvAddr = "10.255.2.37:9876;10.255.2.37:9875"; + String producerGroup = "please_rename_unique_group_name"; String topic = "RequestTopic"; long ttl = 3000; DefaultMQProducer producer = new DefaultMQProducer(producerGroup); - producer.setNamesrvAddr(namesrvAddr); producer.start(); try { @@ -59,6 +57,7 @@ public class AsyncRequestProducer { } catch (Exception e) { log.warn("", e); } + /* shutdown after your request callback is finished */ // producer.shutdown(); } } diff --git a/example/src/main/java/org/apache/rocketmq/example/rpc/RequestProducer.java b/example/src/main/java/org/apache/rocketmq/example/rpc/RequestProducer.java index a83f1db8..b038151a 100644 --- a/example/src/main/java/org/apache/rocketmq/example/rpc/RequestProducer.java +++ b/example/src/main/java/org/apache/rocketmq/example/rpc/RequestProducer.java @@ -28,13 +28,11 @@ public class RequestProducer { private static final InternalLogger log = ClientLogger.getLog(); public static void main(String[] args) throws MQClientException, InterruptedException { - String producerGroup = "ProducerGroup-Name"; - String namesrvAddr = "10.255.2.37:9876;10.255.2.37:9875"; + String producerGroup = "please_rename_unique_group_name"; String topic = "RequestTopic"; long ttl = 3000; DefaultMQProducer producer = new DefaultMQProducer(producerGroup); - producer.setNamesrvAddr(namesrvAddr); producer.start(); try { diff --git a/example/src/main/java/org/apache/rocketmq/example/rpc/ResponseConsumer.java b/example/src/main/java/org/apache/rocketmq/example/rpc/ResponseConsumer.java index 3580f87f..131fc9df 100644 --- a/example/src/main/java/org/apache/rocketmq/example/rpc/ResponseConsumer.java +++ b/example/src/main/java/org/apache/rocketmq/example/rpc/ResponseConsumer.java @@ -38,12 +38,10 @@ public class ResponseConsumer { private static final InternalLogger log = ClientLogger.getLog(); public static void main(String[] args) throws InterruptedException, MQClientException { - String consumerGroup = "ConsumeGroup-Name"; - String namesrvAddr = "10.255.2.37:9873"; + String consumerGroup = "please_rename_unique_group_name"; String topic = "RequestTopic"; DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(consumerGroup); - consumer.setNamesrvAddr(namesrvAddr); consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET); consumer.registerMessageListener(new MessageListenerConcurrently() { -- GitLab