1.在pom.xml 加入配置文件

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-activemq</artifactId>
        </dependency>

2.编辑代码

import org.springframework.jms.annotation.JmsListener;

@Component
public class BpmReceiver {

    @Resource
    JdbcTemplate jdbcTemplate;
    
    @JmsListener(destination = "oa")
        public void  receivedMessage(String message){
        }
}

这个消息message 是从队列读取的消息。

@JmsListener(destination = "oa")

这个 destination  表示队列名称。

3.编辑配置文件

spring:
  activemq: 
    broker-url: tcp://localhost:62222

这样程序就可以从指定的队列读取消息了。

 

相关文章:

  • 2021-10-04
  • 2021-06-08
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2021-11-09
  • 2021-12-05
  • 2022-01-12
  • 2021-04-12
相关资源
相似解决方案