Class FaqMessageService

java.lang.Object
com.bytedesk.kbase.faq.mq.FaqMessageService

@Service public class FaqMessageService extends Object
FAQ消息服务 使用核心模块中的JmsTemplate发送FAQ索引请求
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.springframework.jms.core.JmsTemplate
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    批量发送FAQ到索引队列 增加了发送间隔,避免短时间大量索引请求导致的冲突 使用批处理方式并引入延迟策略,更均匀地分散消息发送时间
    private void
    processBatch(List<String> batch, int totalCount)
    处理一批FAQ索引请求 为每一批内的消息设置不同的延迟,使其错峰到达队列
    void
    发送FAQ删除请求到索引队列 增加了延迟发送机制和重试机制,避免同时大量删除导致冲突
    void
    发送FAQ到索引队列,用于创建或更新索引 增加了延迟发送机制和重试机制,避免同时大量索引导致冲突

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • jmsTemplate

      @Autowired private org.springframework.jms.core.JmsTemplate jmsTemplate
  • Constructor Details

    • FaqMessageService

      public FaqMessageService()
  • Method Details

    • sendToIndexQueue

      public void sendToIndexQueue(String faqUid)
      发送FAQ到索引队列,用于创建或更新索引 增加了延迟发送机制和重试机制,避免同时大量索引导致冲突
      Parameters:
      faqUid - FAQ的唯一标识
    • sendToDeleteQueue

      public void sendToDeleteQueue(String faqUid)
      发送FAQ删除请求到索引队列 增加了延迟发送机制和重试机制,避免同时大量删除导致冲突
      Parameters:
      faqUid - FAQ的唯一标识
    • batchSendToIndexQueue

      public void batchSendToIndexQueue(Iterable<String> faqUids)
      批量发送FAQ到索引队列 增加了发送间隔,避免短时间大量索引请求导致的冲突 使用批处理方式并引入延迟策略,更均匀地分散消息发送时间
      Parameters:
      faqUids - FAQ唯一标识列表
    • processBatch

      private void processBatch(List<String> batch, int totalCount)
      处理一批FAQ索引请求 为每一批内的消息设置不同的延迟,使其错峰到达队列
      Parameters:
      batch - FAQ唯一标识批次
      totalCount - 当前总处理计数