public class ProducerApp { public static void main(String[] args) throws Exception { MqClient client = new MqClient("localhost:15555"); Producer producer = new Producer(client); Message message = new Message(); message.setTopic("topic1"); message.setBody("Hello, Zbus!".getBytes()); producer.send(message); producer.close(); } } public class ConsumerApp { public static void main(String[] args) throws Exception { MqClient client = new MqClient("localhost:15555"); Consumer consumer = new Consumer(client, "topic1"); consumer.onMessage(message -> { System.out.println("Received message: " + new String(message.getBody())); }); consumer.start(); } } mq.serverList=localhost:15555


上一篇:
下一篇:
切换中文