编程知识 cdmana.com

RocketMQ source analysis: how to debug the RocketMQ source in IDEA

 Insert picture description here

To configure RocketMQ Runtime environment

First of all, from the github download rocketmq Source code :https://github.com/apache/rocketmq

Then build a RocketMQ Runtime Directory ,/Users/peng/software/rocketmq( Random designation, huh ). Under this directory 3 A folder ,conf,logs,store.

Then from the source code distribution/conf Folder copy broker.conf,logback_namesrv.xml,logback_broker.xml File to conf Catalog

hold logback_namesrv.xml,logback_broker.xml In the document ${user.home} Replace with /Users/peng/software/rocketmq

stay broker.conf Add the following configuration to the file

# nameserver The address of 
namesrvAddr = 127.0.0.1:9876
#  This is the storage path , You set it to your rocketmq Run Directory store subdirectories 
storePathRootDir = /Users/peng/software/rocketmq/store
#  This is a commitLog Storage path for 
storePathCommitLog = /Users/peng/software/rocketmq/store/commitlog
# consume queue File storage path 
storePathConsumeQueue = /Users/peng/software/rocketmq/store/consumequeue
#  The storage path of the message index file 
storePathIndex = /Users/peng/software/rocketmq/store/index
# checkpoint File storage path 
storeCheckpoint = /Users/peng/software/rocketmq/store/checkpoint
# abort File storage path 
abortFile = /Users/peng/software/rocketmq/abort

start-up NameServer

Click on the run NamesrvStartup class , And then in Environment variables( environment variable ) Add in column ROCKETMQ_HOME environment variable , Start it up
 Insert picture description here

start-up Broker

Click on the run BrokerStartup class , And then in Environment variables Add in column ROCKETMQ_HOME environment variable , stay Program arguments( Program runtime parameters ) Specify profile

-c /Users/peng/software/rocketmq/conf/broker.conf

Start it up
 Insert picture description here

test

stay org.apache.rocketmq.example.quickstart.Producer In this class , Add a line of code to specify nameserver The address of , Then you can send messages normally

 Insert picture description here
stay org.apache.rocketmq.example.quickstart.Consumer In this class , Add a line of code to specify nameserver The address of , Then you can receive messages normally

 Insert picture description here

Reference blog

版权声明
本文为[Java knowledge hall]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/11/20211109055609496U.html

Scroll to Top