这里记录下启动 rocketmq 的启动 和 消息的收发

rocketmq-namesrv

环境变量添加:

ROCKETMQ_HOME  ${YOUR_DOWNLOAD_PATH}/rocketmq/distribution

run 按妞运行服务, 启动成功后, 控制台会输出:

The Name Server boot success. serializeType=JSON

rocketmq-broker

program arguments:

-n localhost:9876

环境变量参数

ROCKETMQ_HOME  ${YOUR_DOWNLOAD_PATH}/rocketmq/distribution

run 按妞运行服务, 启动成功后, 控制台会输出:

The broker[${YOUR_MAC_NAME}, ${YOUR_IP}:${YOUR_PORT}] boot success. serializeType=JSON and name server is localhost:9876 

rocketmq-consumer

环境变量参数

NAMESRV_ADDR=localhost:9876

run 按妞运行服务, 启动成功后, 控制台会输出:

Consumer Started.

rocketmq-producer

环境变量参数

NAMESRV_ADDR=localhost:9876

run 按妞运行服务, 启动成功后, 控制台输出大量SendResult日志如下:

SendResult [sendStatus=SEND_OK, msgId=0A5E54923F6218B4AAC236E079DA0000, offsetMsgId=0A5E549200002A9F0000000000000000, messageQueue=MessageQueue [topic=TopicTest, brokerName=${YOUR_NAME}, queueId=1], queueOffset=0]
.......
.......

此时, consumer 也会输出 接收到的日志内容:

ConsumeMessageThread_1 Receive New Messages: [MessageExt [queueId=0, storeSize=178, queueOffset=0, sysFlag=0, bornTimestamp=1552290281783, bornHost=/${YOUR_BORN_IP_PORT}, storeTimestamp=1552290281784, storeHost=/${YOUR_SOTRE_IP_PORT}, msgId=0A5E549200002A9F0000000000000216, commitLogOffset=534, bodyCRC=1032136437, reconsumeTimes=0, preparedTransactionOffset=0, toString()=Message{topic='TopicTest', flag=0, properties={MIN_OFFSET=0, MAX_OFFSET=45, CONSUME_START_TIME=1552290399156, UNIQ_KEY=0A5E54923F6218B4AAC236E07D370003, WAIT=true, TAGS=TagA}, body=[72, 101, 108, 108, 111, 32, 82, 111, 99, 107, 101, 116, 77, 81, 32, 51], transactionId='null'}]] 
....
....