文档章节

RocketMQ在windows上安装和开发使用

偶尔诗文
 偶尔诗文
发布于 2015/08/25 13:55
字数 2511
阅读 738
收藏 3
  1. 概述
    RocketMQ是alibaba公司开源的一个纯java的开源消息中间件。

  2. 开发测试环境搭建
    1.   安装&启动
    进入到RocketMQ下载包解压的路径下
    D:\machine\RocketMQ-3.0.8\RocketMQ-3.0.8>
    接下来安装
    执行下边的命令或者执行install.bat(在这个bat文件中的命令如下)对maven熟悉的一眼就知道是执行clean package install assembly等操作。
    mvn -Dmaven.test.skip=true clean packageinstall assembly:assembly –U
    操作信息如下:
    [INFO] Scanning for projects...  
    [INFO] ------------------------------------------------------------------------  
    [INFO] Reactor Build Order:  
    [INFO]  
    [INFO] rocketmq-all 3.0.8  
    [INFO] rocketmq-remoting 3.0.8  
    [INFO] rocketmq-common 3.0.8  
    [INFO] rocketmq-client 3.0.8  
    [INFO] rocketmq-store 3.0.8  
    [INFO] rocketmq-broker 3.0.8  
    [INFO] rocketmq-tools 3.0.8  
    [INFO] rocketmq-research 3.0.8  
    [INFO] rocketmq-namesrv 3.0.8  
    [INFO] rocketmq-example 3.0.8  
    [INFO] rocketmq-qatest 3.0.8  
    [INFO]                                                                          
    [INFO] ------------------------------------------------------------------------  
    [INFO] Building rocketmq-all 3.0.8 3.0.8  
    [INFO]------------------------------------------------------------------------  
    [INFO]///省了…..编译打包过程  
    [INFO]------------------------------------------------------------------------  
    [INFO] Reactor Summary:  
    [INFO]  
    [INFO] rocketmq-all 3.0.8................................ SUCCESS [5.861s]  
    [INFO] rocketmq-remoting 3.0.8 ...........................SUCCESS [1.483s]  
    [INFO] rocketmq-common 3.0.8............................. SUCCESS [1.627s]  
    [INFO] rocketmq-client 3.0.8............................. SUCCESS [1.486s]  
    [INFO] rocketmq-store 3.0.8.............................. SUCCESS [1.398s]  
    [INFO] rocketmq-broker 3.0.8............................. SUCCESS [1.512s]  
    [INFO] rocketmq-tools 3.0.8.............................. SUCCESS [1.125s]  
    [INFO] rocketmq-research 3.0.8........................... SUCCESS [0.917s]  
    [INFO] rocketmq-namesrv 3.0.8............................ SUCCESS [0.609s]  
    [INFO] rocketmq-example 3.0.8............................ SUCCESS [0.604s]  
    [INFO] rocketmq-qatest 3.0.8............................. SUCCESS [0.057s]  
    [INFO] ------------------------------------------------------------------------  
    [INFO] BUILD SUCCESS  
    [INFO]------------------------------------------------------------------------  
    [INFO] Total time: 18.145s  
    [INFO] Finished at: Fri Mar 28 10:36:08 CST2014  
    [INFO] Final Memory: 60M/395M  
    [INFO]------------------------------------------------------------------------  
    D:\machine\RocketMQ-3.0.8\RocketMQ-3.0.8>  


    接下来把编译好的项目copy出来(也就是把target目录下的文件拷出来放在你想放的位置)
    [html] view plaincopy
    D:\machine\RocketMQ-3.0.8\RocketMQ-3.0.8\target> xcopy /E alibaba-rocketmq-3.0.8  D:\machine\RocketMQ-3.0.8\  
    D:\machine\RocketMQ-3.0.8>dir  
    驱动器 D 中的卷是 软件  
    卷的序列号是000F-1D4F  
    D:\machine\RocketMQ-3.0.8 的目录  
    2014/03/28 10:44    <DIR>          .  
    2014/03/28 10:44    <DIR>          ..  
    2014/03/28 10:44    <DIR>          alibaba-rocketmq  
    2014/03/07 15:08                52pax_global_header  
    2014/03/28 10:37    <DIR>          RocketMQ-3.0.8  
                   1 个文件             52 字节  
                   4 个目录 105,101,885,440 可用字节  

    D:\machine\RocketMQ-3.0.8>cd alibaba-rocketmq  
    启动服务
    //启动mqnamesrv
    D:\machine\RocketMQ-3.0.8\alibaba-rocketmq>start/b bin/mqnamesrv.exe  >D:\logs\alibaba-rocketmq/mqnamesrv.log  
    可以通过jps查看一下是不是有了RocketMQ的进程,如下方的6484
    C:\Users\houchangren>jps -v  
    6484 -Djava.ext.dirs=D:\machine\RocketMQ-3.0.8\alibaba-rocketmq\bin/../lib-Drocketmq.home.dir=D:\machine\RocketMQ-3.0.8\alibaba-rocketmq\bin/..-XX:MaxNewSize=512M -XX:MaxPermSize=128M -XX:NewSit abort  
    6876 JConsole -Denv.class.path=D:\ProgramFiles\Java\jdk1.6.0_26\lib -Dapplication.home=D:\Program Files\Java\jdk1.6.0_26-Djconsole.showOutputViewer  
    6936org.eclipse.equinox.launcher_1.2.0.v20110502.jar -Dosgi.requiredJavaVersion=1.5-Xms40m -Xmx512m -XX:MaxPermSize=256m  
    4140 Jps -Denv.class.path=D:\ProgramFiles\Java\jdk1.6.0_26\lib -Dapplication.home=D:\Program Files\Java\jdk1.6.0_26-Xms8m  
    看日志中信息D:\logs\alibaba-rocketmq/mqnamesrv.log
    The Name Server boot success.
    //启动broker
    D:\machine\RocketMQ-3.0.8\alibaba-rocketmq>start/b bin/mqbroker.exe -n "10.57.41.19:9876">D:\logs\alibaba-rocketmq/mqbroker.log  
    看日志中信息D:\logs\alibaba-rocketmq/mqbroker.log
    The broker[houchangren, 10.57.41.19:10911]boot success.

    2.项目实例
    1. 创建maven项目
    Pom.xml文件如下
    <project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd">  
    <modelVersion>4.0.0</modelVersion>  
    <groupId>com.ruishenh</groupId>  
    <artifactId>gomeTest</artifactId>  
    <packaging>war</packaging>  
    <version>0.0.1-SNAPSHOT</version>  
    <name>gomeTest Maven Webapp</name>  
    <url>http://maven.apache.org</url>  
    <properties>  
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
       </properties>  
    <dependencies>  
        <dependency>  
             <groupId>com.alibaba.rocketmq</groupId>  
             <artifactId>rocketmq-client</artifactId>  
             <version>3.0.8</version>  
          </dependency>  
          <dependency>  
             <groupId>com.alibaba.rocketmq</groupId>  
             <artifactId>rocketmq-all</artifactId>  
             <version>3.0.8</version>  
             <type>pom</type>  
          </dependency>  
          <dependency>  
             <groupId>ch.qos.logback</groupId>  
             <artifactId>logback-classic</artifactId>  
             <version>1.1.1</version>  
          </dependency>  
          <dependency>  
             <groupId>ch.qos.logback</groupId>  
             <artifactId>logback-core</artifactId>  
             <version>1.1.1</version>  
          </dependency>  
          <dependency>  
             <groupId>junit</groupId>  
             <artifactId>junit</artifactId>  
             <version>4.10</version>  
             <scope>test</scope>  
          </dependency>  
      </dependencies>  
    <build>  
       <finalName>gomeTest</finalName>  
    </build>  
    </project>  

    2.编写消息产生者Producer
    文件路径:/gomeTest/src/main/java/com/ruishenh/rocketmq/example/Producer.java
    package com.ruishenh.rocketmq.example;  
    import java.util.concurrent.TimeUnit;  
    import com.alibaba.rocketmq.client.exception.MQClientException;  
    import com.alibaba.rocketmq.client.producer.DefaultMQProducer;  
    import com.alibaba.rocketmq.client.producer.SendResult;  
    import com.alibaba.rocketmq.common.message.Message;  
    public classProducer {  
       public static void main(String[] args) throws MQClientException,  
             InterruptedException{  
          /**  
           * 一个应用创建一个Producer,由应用来维护此对象,可以设置为全局对象或者单例<br>  
           * 注意:ProducerGroupName需要由应用来保证唯一<br>  
           * ProducerGroup这个概念发送普通的消息时,作用不大,但是发送分布式事务消息时,比较关键,  
           * 因为服务器会回查这个Group下的任意一个Producer  
           */  
          final DefaultMQProducer  producer = new  DefaultMQProducer("ProducerGroupName");  
          producer.setNamesrvAddr("10.57.41.19:9876");  //需要些实际电脑的IP地址,并且电脑环境变量端口号与此端口号一致
          producer.setInstanceName("Producer");  

          /**  
           * Producer对象在使用之前必须要调用start初始化,初始化一次即可<br>  
           * 注意:切记不可以在每次发送消息时,都调用start方法  
           */  
          producer.start();  
          /**  
           * 下面这段代码表明一个Producer对象可以发送多个topic,多个tag的消息。  
           * 注意:send方法是同步调用,只要不抛异常就标识成功。但是发送成功也可会有多种状态,  
           * 例如消息写入Master成功,但是Slave不成功,这种情况消息属于成功,但是对于个别应用如果对消息可靠性要求极高,
           * 需要对这种情况做处理。另外,消息可能会存在发送失败的情况,失败重试由应用来处理。  
           */  
          for (int i = 0; i < 10; i++){  
             try {  
                {  
                    Messagemsg = newMessage("TopicTest1",// topic  
                          "TagA",// tag  
                          "OrderID001",// key  
                          ("Hello MetaQA").getBytes());// body  
                    SendResultsendResult = producer.send(msg);  
                    System.out.println(sendResult);  
                }  
                {  
                    Messagemsg = newMessage("TopicTest2",// topic  
                          "TagB",// tag  
                          "OrderID0034",// key  
                          ("Hello MetaQB").getBytes());// body  
                    SendResultsendResult = producer.send(msg);  
                    System.out.println(sendResult);  
                }  
                {  
                    Messagemsg = newMessage("TopicTest3",// topic  
                          "TagC",// tag  
                          "OrderID061",// key  
                          ("Hello MetaQC").getBytes());// body  
                    SendResultsendResult = producer.send(msg);  
                    System.out.println(sendResult);  
                }  
             }catch(Exception e) {  
                e.printStackTrace();  
             }  
             TimeUnit.MILLISECONDS.sleep(1000);  
          }  
          /**  
           * 应用退出时,要调用shutdown来清理资源,关闭网络连接,从rocketMQ服务器上注销自己  
           * 注意:我们建议应用在JBOSS、Tomcat等容器的退出钩子里调用shutdown方法  
           */  
    //    producer.shutdown();  
          Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {  
             public void run() {  
                producer.shutdown();  
             }  
          }));  
          System.exit(0);  
       }  
    }  
    3. 编写消息消费者Consumer
    文件路径:Test/src/main/java/com/ruishenh/rocketmq/example/PushConsumer.java
    package com.ruishenh.rocketmq.example;  
    import java.util.List;  
    importcom.alibaba.rocketmq.client.consumer.DefaultMQPushConsumer;  
    importcom.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;  
    importcom.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;  
    importcom.alibaba.rocketmq.client.consumer.listener.MessageListenerConcurrently;  
    importcom.alibaba.rocketmq.client.exception.MQClientException;  
    importcom.alibaba.rocketmq.common.message.MessageExt;  
    public class PushConsumer {  
             /**
              * 当前例子是PushConsumer用法,使用方式给用户感觉是消息从RocketMQ服务器推到了应用客户端。
              * 但是实际PushConsumer内部是使用长轮询Pull方式从MetaQ服务器拉消息,然后再回调用户Listener方法
              */  
             publicstatic void main(String[] args) throws InterruptedException,  
                                MQClientException{  
                       /**
                        * 一个应用创建一个Consumer,由应用来维护此对象,可以设置为全局对象或者单例
                        * 注意:ConsumerGroupName需要由应用来保证唯一
                        */  
                       DefaultMQPushConsumer  consumer = new DefaultMQPushConsumer( "ConsumerGroupName");  
                       consumer.setNamesrvAddr("10.57.41.19:9876");  //需要些实际电脑的IP地址,并且电脑环境变量端口号与此端口号一致
                       consumer.setInstanceName("Consumber");  
                       /**
                        * 订阅指定topic下tags分别等于TagA或TagC或TagD
                        */  
                       consumer.subscribe("TopicTest1","TagA || TagC || TagD");  
                       /**
                        * 订阅指定topic下所有消息<br>
                        * 注意:一个consumer对象可以订阅多个topic
                        */  
                       consumer.subscribe("TopicTest2","*");  
                       consumer.registerMessageListener(new  MessageListenerConcurrently() {  
                                public  ConsumeConcurrentlyStatus consumeMessage( List<MessageExt>msgs, ConsumeConcurrentlyContext context) {  
                                         System.out.println(Thread.currentThread().getName() +" Receive New Messages: " + msgs.size());  
                                         MessageExt  msg = msgs.get(0);  
                                         if(msg.getTopic().equals("TopicTest1")) {  
                                                   //执行TopicTest1的消费逻辑  
                                                   if(msg.getTags() != null && msg.getTags().equals("TagA")) {  
                                                            //执行TagA的消费  
                                                            System.out.println(newString(msg.getBody()));  
                                                   }else if (msg.getTags() != null&&msg.getTags().equals("TagC")) {  
                                                            //执行TagC的消费  
                                                            System.out.println(newString(msg.getBody()));  
                                                   }else if (msg.getTags() != null&&msg.getTags().equals("TagD")) {  
                                                            //执行TagD的消费  
                                                            System.out.println(newString(msg.getBody()));  
                                                   }  
                                         }else if (msg.getTopic().equals("TopicTest2")) {  
                                                   System.out.println(newString(msg.getBody()));  
                                         }  
                                         returnConsumeConcurrentlyStatus.CONSUME_SUCCESS;  
                                }  
                       });  
                       /**
                        * Consumer对象在使用之前必须要调用start初始化,初始化一次即可

                        */  
                       consumer.start();  

                       System.out.println("ConsumerStarted.");  
             }  
    }  
    Producer执行console:
    12:05:39.399 [main] DEBUGi.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework
    12:05:39.405 [main] DEBUGi.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8
    12:05:39.411 [main] DEBUGi.n.util.internal.PlatformDependent - Platform: Windows
    12:05:39.411 [main] DEBUGi.n.util.internal.PlatformDependent - Java version: 6
    12:05:39.411 [main] DEBUGi.n.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false
    12:05:39.412 [main] DEBUGi.n.util.internal.PlatformDependent0 - java.nio.ByteBuffer.cleaner: available
    12:05:39.413 [main] DEBUGi.n.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
    12:05:39.413 [main] DEBUGi.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
    12:05:39.413 [main] DEBUGi.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
    12:05:39.413 [main] DEBUGi.n.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: true
    12:05:39.413 [main] DEBUGi.n.util.internal.PlatformDependent - sun.misc.Unsafe: available
    12:05:39.413 [main] DEBUGi.n.util.internal.PlatformDependent - -Dio.netty.noJavassist: false
    12:05:39.414 [main] DEBUGi.n.util.internal.PlatformDependent - Javassist: unavailable
    12:05:39.414 [main] DEBUGi.n.util.internal.PlatformDependent - You don't have Javassist in your classpath or you don't have enough permission to load dynamically generatedclasses.  Please check the configurationfor better performance.
    12:05:39.414 [main] DEBUGi.n.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
    12:05:39.429 [main] DEBUGio.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
    12:05:39.429 [main] DEBUGio.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold:512
    12:05:39.481 [main] DEBUGi.n.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier:0x653a966ddb02e036
    12:05:39.523[NettyClientWorkerThread_1] DEBUG io.netty.util.ResourceLeakDetector --Dio.netty.noResourceLeakDetection: false
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BA16, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=0], queueOffset=66]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BAAB, messageQueue=MessageQueue [topic=TopicTest2,brokerName=houchangren, queueId=0], queueOffset=66]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BB41, messageQueue=MessageQueue[topic=TopicTest3, brokerName=houchangren, queueId=0], queueOffset=66]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BBD6, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=1], queueOffset=66]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BC6B, messageQueue=MessageQueue [topic=TopicTest2,brokerName=houchangren, queueId=1], queueOffset=66]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BD01, messageQueue=MessageQueue[topic=TopicTest3, brokerName=houchangren, queueId=1], queueOffset=66]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BD96, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=2], queueOffset=61]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BE2B, messageQueue=MessageQueue [topic=TopicTest2,brokerName=houchangren, queueId=2], queueOffset=61]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BEC1, messageQueue=MessageQueue[topic=TopicTest3, brokerName=houchangren, queueId=2], queueOffset=61]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BF56, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=3], queueOffset=61]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001BFEB, messageQueue=MessageQueue[topic=TopicTest2, brokerName=houchangren, queueId=3], queueOffset=61]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C081, messageQueue=MessageQueue[topic=TopicTest3, brokerName=houchangren, queueId=3], queueOffset=61]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C116, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=0], queueOffset=67]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C1AB, messageQueue=MessageQueue[topic=TopicTest2, brokerName=houchangren, queueId=0], queueOffset=67]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C241, messageQueue=MessageQueue[topic=TopicTest3, brokerName=houchangren, queueId=0], queueOffset=67]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C2D6, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=1], queueOffset=67]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C36B, messageQueue=MessageQueue[topic=TopicTest2, brokerName=houchangren, queueId=1], queueOffset=67]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C401, messageQueue=MessageQueue[topic=TopicTest3, brokerName=houchangren, queueId=1], queueOffset=67]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C496, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=2], queueOffset=62]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C52B, messageQueue=MessageQueue[topic=TopicTest2, brokerName=houchangren, queueId=2], queueOffset=62]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C5C1, messageQueue=MessageQueue [topic=TopicTest3,brokerName=houchangren, queueId=2], queueOffset=62]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C656, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=3], queueOffset=62]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C6EB, messageQueue=MessageQueue[topic=TopicTest2, brokerName=houchangren, queueId=3], queueOffset=62]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C781, messageQueue=MessageQueue [topic=TopicTest3,brokerName=houchangren, queueId=3], queueOffset=62]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C816, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=0], queueOffset=68]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C8AB, messageQueue=MessageQueue[topic=TopicTest2, brokerName=houchangren, queueId=0], queueOffset=68]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C941, messageQueue=MessageQueue[topic=TopicTest3, brokerName=houchangren, queueId=0], queueOffset=68]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001C9D6, messageQueue=MessageQueue[topic=TopicTest1, brokerName=houchangren, queueId=1], queueOffset=68]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001CA6B, messageQueue=MessageQueue[topic=TopicTest2, brokerName=houchangren, queueId=1], queueOffset=68]
    SendResult [sendStatus=SEND_OK,msgId=0A39291300002A9F000000000001CB01, messageQueue=MessageQueue[topic=TopicTest3, brokerName=houchangren, queueId=1], queueOffset=68]

    Consumer执行console:
    12:00:49.539 [main] DEBUGi.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework
    12:00:49.545 [main] DEBUGi.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8
    12:00:49.550 [main] DEBUGi.n.util.internal.PlatformDependent - Platform: Windows
    12:00:49.550 [main] DEBUGi.n.util.internal.PlatformDependent - Java version: 6
    12:00:49.550 [main] DEBUGi.n.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false
    12:00:49.551 [main] DEBUGi.n.util.internal.PlatformDependent0 - java.nio.ByteBuffer.cleaner: available
    12:00:49.552 [main] DEBUGi.n.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
    12:00:49.552 [main] DEBUGi.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
    12:00:49.552 [main] DEBUGi.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
    12:00:49.552 [main] DEBUGi.n.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: true
    12:00:49.552 [main] DEBUGi.n.util.internal.PlatformDependent - sun.misc.Unsafe: available
    12:00:49.552 [main] DEBUGi.n.util.internal.PlatformDependent - -Dio.netty.noJavassist: false
    12:00:49.553 [main] DEBUGi.n.util.internal.PlatformDependent - Javassist: unavailable
    12:00:49.553 [main] DEBUGi.n.util.internal.PlatformDependent - You don't have Javassist in your classpath or you don't have enough permission to load dynamically generatedclasses.  Please check the configurationfor better performance.
    12:00:49.553 [main] DEBUGi.n.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
    12:00:49.568 [main] DEBUGio.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
    12:00:49.568 [main] DEBUGio.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold:512
    12:00:49.622 [main] DEBUGi.n.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier:0x2e4f8e2e67b4cc9b
    12:00:49.663[NettyClientWorkerThread_1] DEBUG io.netty.util.ResourceLeakDetector --Dio.netty.noResourceLeakDetection: false
    Consumer Started.
    ConsumeMessageThread-ConsumerGroupName-4Receive New Messages: 1
    Hello MetaQA
    ConsumeMessageThread-ConsumerGroupName-2Receive New Messages: 1
    Hello MetaQA
    ConsumeMessageThread-ConsumerGroupName-1Receive New Messages: 1
    Hello MetaQA
    ConsumeMessageThread-ConsumerGroupName-6Receive New Messages: 1
    Hello MetaQA
    ConsumeMessageThread-ConsumerGroupName-5Receive New Messages: 1
    ConsumeMessageThread-ConsumerGroupName-3Receive New Messages: 1
    Hello MetaQA
    ConsumeMessageThread-ConsumerGroupName-8Receive New Messages: 1
    Hello MetaQA
    Hello MetaQA
    ConsumeMessageThread-ConsumerGroupName-9Receive New Messages: 1
    Hello MetaQA
    ConsumeMessageThread-ConsumerGroupName-10Receive New Messages: 1
    Hello MetaQA
    ConsumeMessageThread-ConsumerGroupName-7Receive New Messages: 1
    Hello MetaQA
    ConsumeMessageThread-ConsumerGroupName-11Receive New Messages: 1
    Hello MetaQB
    ConsumeMessageThread-ConsumerGroupName-12Receive New Messages: 1
    Hello MetaQB
    ConsumeMessageThread-ConsumerGroupName-13Receive New Messages: 1
    Hello MetaQB
    ConsumeMessageThread-ConsumerGroupName-15Receive New Messages: 1
    Hello MetaQB
    ConsumeMessageThread-ConsumerGroupName-14Receive New Messages: 1
    Hello MetaQB
    ConsumeMessageThread-ConsumerGroupName-16Receive New Messages: 1
    ConsumeMessageThread-ConsumerGroupName-17Receive New Messages: 1
    Hello MetaQB
    Hello MetaQB
    ConsumeMessageThread-ConsumerGroupName-18Receive New Messages: 1
    ConsumeMessageThread-ConsumerGroupName-19Receive New Messages: 1
    Hello MetaQB
    Hello MetaQB
    ConsumeMessageThread-ConsumerGroupName-20Receive New Messages: 1
    Hello MetaQB

本文转载自:http://www.iyunv.com/thread-16475-1-1.html

共有 人打赏支持
偶尔诗文
粉丝 10
博文 144
码字总数 63966
作品 0
沈阳
高级程序员
私信 提问
加载中

评论(2)

偶尔诗文
偶尔诗文

引用来自“moluqianli”的评论

mqbroker.exe 我怎么找不到啊???
可以去rocketMQ的GitHub下载https://github.com/alibaba/RocketMQ
陌路千里
陌路千里
mqbroker.exe 我怎么找不到啊???
RocketMQ消息队列还没入门就想放弃

题外话 什么情况下的异步操作需要使用消息队列而不是多线程? 消息队列和多线程两者并不冲突,多线程可以作为队列的生产者和消费者。 使用外部的消息队列时,第一是可以提高应用的稳定性,当程...

FutaoSmile丶
10/19
0
0
RocketMQ在windows环境下的安装与配置

1、下载RocketMQ 2、解压下载的安装包rocketmq-all-4.3.0-bin-release.zip 3、配置环境变量 变量名:ROCKETMQ_HOME 变量值:MQ解压路径 ROCKETMQ_HOME=D:devtoolsrocketmq-all-4.3.0-bin-rel...

技术小能手
10/22
0
0
RocketMQ:一个纯java的开源消息中间件--开发测试环境搭建

一、简介 RocketMQ的前身是Metaq,当Metaq3.0发布时,产品名称改为RocketMQ MetaQ2.x版本由于依赖了alibaba公司内部其他系统,对于公司外部用户使用不够友好,推荐使用3.0版本。 项目地址:h...

cloud-coder
2014/02/18
0
15
发力IOT、大数据,Apache RocketMQ 构建云时代的新生态

摘要 2018年9月1日,由阿里巴巴中间件举办的RocketMQ开发者沙龙在北京举行。这是RocketMQ今年举办的第二次大型线下技术交流活动,出席技术沙龙的嘉宾包括Apache RocketMQ创始人、OpenMessagi...

中间件小哥
09/21
0
0
rocketmq4.x快速入门指南

以下采用的是版本 相关文档如下 快速体验: http://blog.seoui.com/2018/07/24/rocketmqinstall/ rocketmq简单消息发送: http://blog.seoui.com/2018/07/24/rocketmq_simple_message/ rock......

peachyy
08/02
0
0

没有更多内容

加载失败,请刷新页面

加载更多

babel6升级到7,jest-babel报错:Requires Babel "^7.0.0-0", but was loaded with "6.26.3".

自从将前端环境更新到babel7,jest-babel之前是基于babel6的,执行时候就会报:Requires Babel "^7.0.0-0", but was loaded with "6.26.3". 很烦,因为连续帮好几台电脑修复这个问题,所以记...

曾建凯
46分钟前
1
0
探索802.11ax

802.11ax承诺在真实条件下改善峰值性能和最差情况。 如何改善今天的Wi-Fi? 在决定如何改进当前版本以外的Wi-Fi时,802.11ac,IEEE和Wi-Fi联盟调查了Wi-Fi部署和行为,以确定更广泛使用的障碍...

linuxprobe16
今天
2
0
使用linux将64G的SDCARD格式化为FAT32

一、命令如下: sudo fdisk -lsudo mkfs.vfat /dev/sda -Isudo fdisk /dev/sda Welcome to fdisk (util-linux 2.29.2). Changes will remain in memory only, until you decide to wri......

mbzhong
今天
4
0
深入理解Plasma(四):Plasma Cash

这一系列文章将围绕以太坊的二层扩容框架,介绍其基本运行原理,具体操作细节,安全性讨论以及未来研究方向等。本篇文章主要介绍在 Plasma 框架下的项目 Plasma Cash。 深入理解Plasma(1):...

HiBlock
昨天
1
0
命令参数的三大风格:Posix、BSD、GNU

今天读到命令行中参数的风格有三大类,即Unix/Posix、BSD、GNU。分别有以下特征: Unix/Posix风格,即命令后的参数,可以分组,便必须以连字符开头,如ps -aux。 BSD风格,即命令后的参数,可...

大别阿郎
昨天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部