gpt4 book ai didi

me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker类的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 04:01:05 25 4
gpt4 key购买 nike

本文整理了Java中me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker类的一些代码示例,展示了WxMessageInMemoryDuplicateChecker类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WxMessageInMemoryDuplicateChecker类的具体详情如下:
包路径:me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker
类名称:WxMessageInMemoryDuplicateChecker

WxMessageInMemoryDuplicateChecker介绍

[英]```
默认消息重复检查器
将每个消息id保存在内存里,每隔5秒清理已经过期的消息id,每个消息id的过期时间是15秒

[中]```
默认消息重复检查器 
将每个消息id保存在内存里,每隔5秒清理已经过期的消息id,每个消息id的过期时间是15秒

代码示例

代码示例来源:origin: chanjarster/weixin-java-tools

public WxMpMessageRouter(WxMpService wxMpService) {
 this.wxMpService = wxMpService;
 this.executorService = Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE);
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

代码示例来源:origin: chanjarster/weixin-java-tools

@Override
public boolean isDuplicate(String messageId) {
 if (messageId == null) {
  return false;
 }
 checkBackgroundProcessStarted();
 Long timestamp = msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis());
 if (timestamp == null) {
  // 第一次接收到这个消息
  return false;
 }
 return true;
}

代码示例来源:origin: chanjarster/weixin-java-tools

public WxCpMessageRouter(WxCpService wxCpService) {
 this.wxCpService = wxCpService;
 this.executorService = Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE);
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

代码示例来源:origin: com.github.binarywang/weixin-java-common

@Override
public boolean isDuplicate(String messageId) {
 if (messageId == null) {
  return false;
 }
 checkBackgroundProcessStarted();
 Long timestamp = this.msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis());
 return timestamp != null;
}

代码示例来源:origin: com.github.binarywang/weixin-java-miniapp

public WxMaMessageRouter(WxMaService wxMaService) {
 this.wxMaService = wxMaService;
 ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("WxMaMessageRouter-pool-%d").build();
 this.executorService = new ThreadPoolExecutor(DEFAULT_THREAD_POOL_SIZE, DEFAULT_THREAD_POOL_SIZE,
  0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), namedThreadFactory);
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

代码示例来源:origin: binarywang/WxJava

@Override
public boolean isDuplicate(String messageId) {
 if (messageId == null) {
  return false;
 }
 checkBackgroundProcessStarted();
 Long timestamp = this.msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis());
 return timestamp != null;
}

代码示例来源:origin: binarywang/WxJava

public WxMaMessageRouter(WxMaService wxMaService) {
 this.wxMaService = wxMaService;
 ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("WxMaMessageRouter-pool-%d").build();
 this.executorService = new ThreadPoolExecutor(DEFAULT_THREAD_POOL_SIZE, DEFAULT_THREAD_POOL_SIZE,
  0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), namedThreadFactory);
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

代码示例来源:origin: me.chanjar/weixin-java-common

@Override
public boolean isDuplicate(String messageId) {
 if (messageId == null) {
  return false;
 }
 checkBackgroundProcessStarted();
 Long timestamp = msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis());
 if (timestamp == null) {
  // 第一次接收到这个消息
  return false;
 }
 return true;
}

代码示例来源:origin: com.github.binarywang/weixin-java-mp

public WxMpMessageRouter(WxMpService wxMpService) {
 this.wxMpService = wxMpService;
 this.executorService = Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE);
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

代码示例来源:origin: binarywang/WxJava

public WxMpMessageRouter(WxMpService wxMpService) {
 this.wxMpService = wxMpService;
 this.executorService = Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE);
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

代码示例来源:origin: me.chanjar/weixin-java-mp

public WxMpMessageRouter(WxMpService wxMpService) {
 this.wxMpService = wxMpService;
 this.executorService = Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE);
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

代码示例来源:origin: binarywang/WxJava

public WxCpMessageRouter(WxCpService wxCpService) {
 this.wxCpService = wxCpService;
 this.executorService = Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE);
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

代码示例来源:origin: binarywang/WxJava

/**
 * <pre>
 * 使用自定义的 {@link ExecutorService}
 * </pre>
 */
public WxMpMessageRouter(WxMpService wxMpService, ExecutorService executorService) {
 this.wxMpService = wxMpService;
 this.executorService = executorService;
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

代码示例来源:origin: com.github.binarywang/weixin-java-mp

/**
 * <pre>
 * 使用自定义的 {@link ExecutorService}
 * </pre>
 */
public WxMpMessageRouter(WxMpService wxMpService, ExecutorService executorService) {
 this.wxMpService = wxMpService;
 this.executorService = executorService;
 this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
 this.sessionManager = new StandardSessionManager();
 this.exceptionHandler = new LogExceptionHandler();
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com