From 4ef2d7a74beb60599acde66d16c82ed50a3b7104 Mon Sep 17 00:00:00 2001 From: "Frank.R.Wu" Date: Sun, 31 Oct 2021 23:17:00 +0800 Subject: [PATCH] feat: update event subscriber update EventSubscriberClient.subscribeEvent to use event mechanism --- src/main/sdk/org/bdware/client/EventSubscriberClient.java | 5 ++--- src/test/java/org/bdware/client/test/EventClientTest.java | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/sdk/org/bdware/client/EventSubscriberClient.java b/src/main/sdk/org/bdware/client/EventSubscriberClient.java index d70866b..9de9b8d 100644 --- a/src/main/sdk/org/bdware/client/EventSubscriberClient.java +++ b/src/main/sdk/org/bdware/client/EventSubscriberClient.java @@ -65,12 +65,11 @@ public class EventSubscriberClient implements Handler { bc.sendText(new Gson().toJson(setNodeID)); } - public void subscribeEvent(String nodeID, String contractID, String event) { + public void subscribeEvent(String contractID, String topic) { Map msg = new HashMap<>(); msg.put("action", "subEvent"); - msg.put("target", nodeID); msg.put("contractID", contractID); - msg.put("event", event); + msg.put("topic", topic); bc.sendText(new Gson().toJson(msg)); } } diff --git a/src/test/java/org/bdware/client/test/EventClientTest.java b/src/test/java/org/bdware/client/test/EventClientTest.java index 7ce9fc6..6b4946d 100644 --- a/src/test/java/org/bdware/client/test/EventClientTest.java +++ b/src/test/java/org/bdware/client/test/EventClientTest.java @@ -16,7 +16,6 @@ public class EventClientTest { testClient.waitForConnect(); testClient.subscribeEvent( - "04889daf457aae33f382d3d7688f154a1ffdd057b660e626314f46fd6864c3162bf941b25abe98dd9d7df4d44e31570a15166883271b0c901931db82f714aeeebf", "BDCoinAt162", "Transfer"); try { @@ -25,7 +24,7 @@ public class EventClientTest { e.printStackTrace(); } Scanner sc = new Scanner(System.in); - for (; ; ) { + while (true) { String cmd = sc.nextLine(); System.out.println("Wait for event"); }