Class ArticleMessageService

java.lang.Object
com.bytedesk.kbase.article.mq.ArticleMessageService

@Service public class ArticleMessageService extends Object
文章消息服务 使用核心模块中的JmsTemplate发送文章索引请求
  • 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
    批量发送文章到索引队列 增加了发送间隔,避免短时间大量索引请求导致的冲突 使用批处理方式并引入延迟策略,更均匀地分散消息发送时间
    private void
    processBatch(List<String> batch, int count)
    处理批量发送的辅助方法
    void
    发送文章删除请求到索引队列 增加了延迟发送机制和重试机制,避免同时大量删除导致冲突
    void
    发送文章到索引队列,用于创建或更新索引 增加了延迟发送机制和重试机制,避免同时大量索引导致冲突

    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

    • ArticleMessageService

      public ArticleMessageService()
  • Method Details

    • sendToIndexQueue

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

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

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

      private void processBatch(List<String> batch, int count)
      处理批量发送的辅助方法
      Parameters:
      batch - 批次数据
      count - 当前计数