From cdb4485ca24fc6644c4177afff366bb447f1a531 Mon Sep 17 00:00:00 2001 From: noear Date: Tue, 27 Feb 2024 11:44:57 +0800 Subject: [PATCH] 1.2.2 --- .../src/test/java/features/cases/TestCase25_rpc.java | 10 +++++----- .../main/java/org/noear/folkmq/client/MqRouter.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/folkmq-test/src/test/java/features/cases/TestCase25_rpc.java b/folkmq-test/src/test/java/features/cases/TestCase25_rpc.java index baa5e106..85bdf991 100644 --- a/folkmq-test/src/test/java/features/cases/TestCase25_rpc.java +++ b/folkmq-test/src/test/java/features/cases/TestCase25_rpc.java @@ -25,23 +25,23 @@ public void start() throws Exception { //客户端 client = FolkMQ.createClient("folkmq://127.0.0.1:" + getPort()) - .nameAs("demoapp") + .nameAs("app1") .connect(); - client.listen(new MqRouter(m -> m.getTag()).onConsume(m -> { + client.listen(new MqRouter(m -> m.getTag()).doOnConsume(m -> { - }).on("test.hello", m -> { + }).doOn("test.hello", m -> { m.acknowledge(new StringEntity(m.getSender() + ": me to! rev: " + m.getContent())); })); MqClient client2 = FolkMQ.createClient("folkmq://127.0.0.1:" + getPort()) - .nameAs("testapp") + .nameAs("app2") .connect(); //开始 rpc 请求 - Reply reply = client2.send(new MqMessage("hello").tag("test.hello"), "demoapp").await(); + Reply reply = client2.send(new MqMessage("hello").tag("test.hello"), client.name()).await(); String rst = reply.dataAsString(); //检验客户端 diff --git a/folkmq/src/main/java/org/noear/folkmq/client/MqRouter.java b/folkmq/src/main/java/org/noear/folkmq/client/MqRouter.java index 018ee4ae..0f9fe4a1 100644 --- a/folkmq/src/main/java/org/noear/folkmq/client/MqRouter.java +++ b/folkmq/src/main/java/org/noear/folkmq/client/MqRouter.java @@ -19,12 +19,12 @@ public MqRouter(Function mappingHandler) { this.mappingHandler = mappingHandler; } - public MqRouter on(String mapping, MqConsumeHandler consumeHandler) { + public MqRouter doOn(String mapping, MqConsumeHandler consumeHandler) { mappingMap.put(mapping, consumeHandler); return this; } - public MqRouter onConsume(MqConsumeHandler consumeHandler) { + public MqRouter doOnConsume(MqConsumeHandler consumeHandler) { this.consumeHandler = consumeHandler; return this; }