1 回答

TA貢獻1982條經驗 獲得超2個贊
就我而言,我的代碼模擬了錯誤的郵箱。事實證明,我需要維護一張地圖,如下所示:
private Map<StreamingSubscription, String> reverseSubscriptions = Collections.synchronizedMap(new HashMap<>());
然后在 notificationEventDelegate(..) 方法中...
稱呼
String mailbox = reverseSubscriptions.get(args.getSubscription());
處理項目事件時...
private void processItemEvent(ExchangeService service, String mailbox, ItemEvent itemEvent) throws Exception {
synchronized(service) {
service.setImpersonatedUserId(impersonateAccount(mailbox));
service.getHttpHeaders().put("X-AnchorMailbox", mailbox);
service.getHttpHeaders().put("X-PreferServerAffinity", "true");
try {
...
} catch (Exception ie) {
...
}
}
}
}
添加回答
舉報