1: 参考链接
https://open.dingtalk.com/document/orgapp/develop-stream-mode-push-server
2:钉钉开放平台订阅配置
配置之后运行一下上面提供的链接 里面的main方法,验证通道
3:订阅启动方式
EventListenerThread eventListenerThread = application.getBean(EventListenerThread.class); // 启动EventListenerThread eventListenerThread.start();
@Override public void run() {OpenDingTalkStreamClientBuilder.custom().credential(new AuthClientCredential(appKey, appSecret))//注册事件监听.registerAllEventListener(new GenericEventListener() {public EventAckStatus onEvent(GenericOpenDingTalkEvent event) {try {//事件唯一IdString eventId = event.getEventId();//事件类型String eventType = event.getEventType();//事件产生时间Long bornTime = event.getEventBornTime();//获取事件体JSONObject bizData = event.getData();log.info("当前时间"+ TimeUtils.date2Str(new Date()));// Create InputStream from byte arraylog.info("进入事件订阅:eventId "+eventId+"eventType"+eventType+"bornTime"+bornTime);//处理事件evetTypeEvent(eventId,eventType,bornTime,bizData);//消费成功return EventAckStatus.SUCCESS;} catch (Exception e) {//消费失败return EventAckStatus.LATER;}}}).build().start(); }