ZY
2024-08-21 2442466124d2e8a420cd6a1026ee04e61b0fc591
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);
 
    }
}