第一次使用spring boot整合RabbitMQ

1.首先搭建springboot,这个很简单
pom.xml引用如下,包括springboot+mybits+rabbitMQ


4.0.0

spboot
spboot
1.0-SNAPSHOT

springboot-mybatis-demo
Demo project for Spring Boot


    org.springframework.boot
    spring-boot-starter-parent
    1.5.6.RELEASE
     



    UTF-8
    UTF-8
    1.7



    
        org.mybatis.spring.boot
        mybatis-spring-boot-starter
        1.3.0
    
    
        org.springframework.boot
        spring-boot-starter-thymeleaf
    
    
        org.springframework.boot
        spring-boot-starter-web
    
    
        org.springframework.boot
        spring-boot-devtools
        true
    
    
        org.springframework.boot
        spring-boot-starter-test
        test
    
    
        mysql
        mysql-connector-java
        5.1.35
    


    
        com.fasterxml.jackson.core
        jackson-core
    
    
        com.fasterxml.jackson.core
        jackson-databind
    
    
        com.fasterxml.jackson.datatype
        jackson-datatype-joda
    
    
        com.fasterxml.jackson.module
        jackson-module-parameter-names
    
    
    
        com.github.pagehelper
        pagehelper-spring-boot-starter
        1.1.2
    
    
    
        com.alibaba
        druid-spring-boot-starter
        1.1.0
    
    
        cn.easyproject
        ojdbc6
        12.1.0.2.0
        pom
    
    
        ai.ost
        fastjson-protobuf
        0.1.3
        sources
        java-source
    
    
        net.sourceforge.nekohtml
        nekohtml
        1.9.22
    
    
        org.springframework.boot
        spring-boot-starter-amqp
    


    
        
            org.springframework.boot
            spring-boot-maven-plugin
        
        
        
            org.mybatis.generator
            mybatis-generator-maven-plugin
            1.3.2
            
                ${basedir}/src/main/resources/generator/generatorConfig.xml
                true
                true
            
        
    

application.yml

server:
  port: 8008

spring:
    datasource:
        name: test
        url: jdbc:oracle:thin:@128.9.7.21:1521:DevGDSYDB
        username: activity
        password: activity
        type: com.alibaba.druid.pool.DruidDataSource
        driver-class-name: oracle.jdbc.driver.OracleDriver
        filters: stat
        maxActive: 20
        initialSize: 1
        maxWait: 60000
        minIdle: 1
        timeBetweenEvictionRunsMillis: 60000
        minEvictableIdleTimeMillis: 300000
        validationQuery: select 'x'
        testWhileIdle: true
        testOnBorrow: false
        testOnReturn: false
        poolPreparedStatements: true
        maxOpenPreparedStatements: 20
    application:
        name: spirng-boot-rabbitmq
    rabbitmq:
        host: 127.0.0.1
        port: 5672
        username: admin
        password: 123456 
    thymeleaf:
        content-type:text/html
        cache:false
        mode :LEGACYHTML5
mybatis:
  mapper-locations: classpath:mapping/*.xml
  type-aliases-package: com.demo.model 
pagehelper:
    helperDialect: oracle
    reasonable: true
    supportMethodsArguments: true
    params: count=countSql

2.安装RabbitMQ
安装RabbitMQ之前,需要安装erlang
Erlang官网下载地址:http://www.erlang.org/ ,我是64位机器,就下载otp_win64_21.2.exe
安装完成后,下载RabbitMQ
下载地址:https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.7.13-beta.1
安装即可
安装完成后,配置RabbitMQ,可根据博客https://www.cnblogs.com/ericli-ericli/p/5902270.html
登录RabbitMQ管理界面,需要看新增用户的权限,否则增加队列会被拒绝,新增队列后就可以在java代码里使用该队列了。
3.代码里使用,可根据博客:https://www.cnblogs.com/ityouknow/p/6120544.html
4.spring boot整合rabbitmq的广播配置,参考https://blog.csdn.net/weixiaohuai/article/details/82825658

你可能感兴趣的:(第一次使用spring boot整合RabbitMQ)