https://open.dingtalk.com/document/orgapp/develop-stream-mode-push-server
配置之后运行一下上面提供的链接 里面的main方法,验证通道
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 { //事件唯一Id String 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 array log.info("进入事件订阅:eventId "+eventId+"eventType"+eventType+"bornTime"+bornTime); //处理事件 evetTypeEvent(eventId,eventType,bornTime,bizData); //消费成功 return EventAckStatus.SUCCESS; } catch (Exception e) { //消费失败 return EventAckStatus.LATER; } } }) .build().start(); }