@@ -166,6 +166,13 @@ public interface WxCpService {
WxSession getSession(String id, boolean create);
/**
+ * 获取WxSessionManager 对象
+ *
+ * @return WxSessionManager
+ */
+ WxSessionManager getSessionManager();
+
+ /**
* <pre>
* 设置WxSessionManager,只有当需要使用个性化的WxSessionManager的时候才需要调用此方法,
* WxCpService默认使用的是{@link me.chanjar.weixin.common.session.StandardSessionManager}
@@ -286,6 +286,11 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
}
@Override
+ public WxSessionManager getSessionManager() {
+ return this.sessionManager;
+ }
+ @Override
public String replaceParty(String mediaId) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/batch/replaceparty";
JsonObject jsonObject = new JsonObject();
@@ -73,7 +73,7 @@ public class WxCpMessageRouter {
this.wxCpService = wxCpService;
this.executorService = Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE);
this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
- this.sessionManager = new StandardSessionManager();
+ this.sessionManager = wxCpService.getSessionManager();
this.exceptionHandler = new LogExceptionHandler();