mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-01 05:46:12 +08:00
@@ -13,7 +13,7 @@ $ bin/mqadmin updateNamesrvConfig -k orderMessageEnable -v true
|
||||
```shell
|
||||
$ bin/mqadmin updateTopic -w 8 -r 8 -a +cleanup.policy=COMPACTION -n localhost:9876 -t ctopic -o true -c DefaultCluster
|
||||
create topic to 127.0.0.1:10911 success.
|
||||
TopicConfig [topicName=ctopic, readQueueNums=8, writeQueueNums=8, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false, attributes={+delete.policy=COMPACTION}]
|
||||
TopicConfig [topicName=ctopic, readQueueNums=8, writeQueueNums=8, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false, attributes={+cleanup.policy=COMPACTION}]
|
||||
```
|
||||
|
||||
### 生产数据
|
||||
@@ -28,7 +28,7 @@ producer.start();
|
||||
String topic = "ctopic";
|
||||
String tag = "tag1";
|
||||
String key = "key1";
|
||||
Message msg = new Message(topic, tag, key, "bodys"getBytes(StandardCharsets.UTF_8));
|
||||
Message msg = new Message(topic, tag, key, "bodys".getBytes(StandardCharsets.UTF_8));
|
||||
SendResult sendResult = producer.send(msg, (mqs, message, shardingKey) -> {
|
||||
int select = Math.abs(shardingKey.hashCode());
|
||||
if (select < 0) {
|
||||
@@ -64,7 +64,7 @@ messageQueueList.forEach(mq -> {
|
||||
Map<String, byte[]> kvStore = Maps.newHashMap();
|
||||
while (true) {
|
||||
List<MessageExt> msgList = consumer.poll(1000);
|
||||
if (msgList != null) {
|
||||
if (CollectionUtils.isNotEmpty(msgList)) {
|
||||
msgList.forEach(msg -> kvStore.put(msg.getKeys(), msg.getBody()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ $ bin/mqadmin updateNamesrvConfig -k orderMessageEnable -v true
|
||||
```shell
|
||||
$ bin/mqadmin updateTopic -w 8 -r 8 -a +cleanup.policy=COMPACTION -n localhost:9876 -t ctopic -o true -c DefaultCluster
|
||||
create topic to 127.0.0.1:10911 success.
|
||||
TopicConfig [topicName=ctopic, readQueueNums=8, writeQueueNums=8, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false, attributes={+delete.policy=COMPACTION}]
|
||||
TopicConfig [topicName=ctopic, readQueueNums=8, writeQueueNums=8, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false, attributes={+cleanup.policy=COMPACTION}]
|
||||
```
|
||||
|
||||
### produce message
|
||||
@@ -25,7 +25,7 @@ producer.start();
|
||||
String topic = "ctopic";
|
||||
String tag = "tag1";
|
||||
String key = "key1";
|
||||
Message msg = new Message(topic, tag, key, "bodys"getBytes(StandardCharsets.UTF_8));
|
||||
Message msg = new Message(topic, tag, key, "bodys".getBytes(StandardCharsets.UTF_8));
|
||||
SendResult sendResult = producer.send(msg, (mqs, message, shardingKey) -> {
|
||||
int select = Math.abs(shardingKey.hashCode());
|
||||
if (select < 0) {
|
||||
@@ -59,7 +59,7 @@ messageQueueList.forEach(mq -> {
|
||||
Map<String, byte[]> kvStore = Maps.newHashMap();
|
||||
while (true) {
|
||||
List<MessageExt> msgList = consumer.poll(1000);
|
||||
if (msgList != null) {
|
||||
if (CollectionUtils.isNotEmpty(msgList)) {
|
||||
msgList.forEach(msg -> kvStore.put(msg.getKeys(), msg.getBody()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user