rocketmq批量消息投递
批量发送消息可提高传递小消息的性能。同时也需要满足以下特征
小于1MB
String topic = "BatchTest"; List<Message> messages = new ArrayList<>(); messages.add(new Message(topic, "TagA", "Order1", "Hello world 0".getBytes())); messages.add(new Message(topic, "TagA", "Order2", "Hello world 1".getBytes())); messages.add(new Message(topic, "TagA", "Order3", "Hello world 2".getBytes())); try { producer.send(messages); } catch (Exception e) { e.printStackTrace(); }