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
  • 相关阅读:
    HDU5120
    POJ 1062
    POJ 1086
    BestCoder 1st Anniversary (HDU 5311)
    HDU 5284
    Dylans loves sequence(hdu5273)
    day65 作业
    第三次小组分享 猴子补丁
    day59 csrf auth
    day58 cookie session 中间件
  • 原文地址:https://www.cnblogs.com/mm163/p/10981109.html
Copyright © 2011-2022 走看看