ZY
2024-08-16 57e23c353a177b9c003a2f524a2adeaf641e2e4c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package com.zy.asrs.wms.common.event;
 
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
 
//实现ApplicationListener接口,并指定监听的事件类型
@Component
public class OrderBatchListener implements ApplicationListener<OrderBatchEvent> {
 
    @Override
    public void onApplicationEvent(OrderBatchEvent event) {
        //使用onApplicationEvent方法对消息进行接受处理
        String orderId = event.getOrderId();
        System.out.println("DemoListener获取到了监听消息:" + orderId);
 
    }
}