zoukankan      html  css  js  c++  java
  • springboot与mq(2)

     <dependency>
                <groupId>org.springframework.amqp</groupId>
                <artifactId>spring-rabbit</artifactId>
                <version>2.1.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-messaging</artifactId>
                <version>5.1.7.RELEASE</version>
            </dependency>

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-amqp</artifactId>
    </dependency>
    <dependency>
    <groupId>com.rabbitmq</groupId>
    <artifactId>amqp-client</artifactId>
    <version>5.7.1</version>
    </dependency>

      

    @Autowired
    RabbitTemplate rabbitTemplate;
    private final static String Exchange_NAME ="hello";
    String routingKey ="goods.delete";
    private final static String QUEUE_NAME ="hello1";
    @Test
    public void send() throws Exception{
       Map<String,Object> map = new HashMap<>();
       map.put("1","haha");
        rabbitTemplate.convertAndSend("hello","goods.delete",map);
    }
    @Test
    public void receive(){
        rabbitTemplate.receiveAndConvert(QUEUE_NAME);
    }
    spring:
      rabbitmq:
        host: 127.0.0.1
        username: mm
        password: 123
        port: 5672
        virtual-host: /test
  • 相关阅读:
    NOI2015刷题记录
    [WC2013][UOJ58]糖果公园 莫队算法
    啦啦啦~
    完全平方数
    构建之法
    测试更新
    程序的测试
    程序的封装
    构建之法5.5-6-7章观后感
    给徐侃童鞋的一个汉堡
  • 原文地址:https://www.cnblogs.com/mm163/p/10981109.html
Copyright © 2011-2022 走看看