Skip to content

Commit

Permalink
1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
noear committed Feb 27, 2024
1 parent 69ef899 commit cdb4485
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions folkmq-test/src/test/java/features/cases/TestCase25_rpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

//检验客户端
Expand Down
4 changes: 2 additions & 2 deletions folkmq/src/main/java/org/noear/folkmq/client/MqRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public MqRouter(Function<MqMessageReceived, String> 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;
}
Expand Down

0 comments on commit cdb4485

Please sign in to comment.