注解

介绍 LOKI 注解包相关类详解(更多详细描述可点击查看源码注释)

注解类包:

👉 loki-annotationopen in new window

@MessageNameopen in new window

  • 描述:消息名注解
属性类型是否必须默认值描述
topicString是无topic名称
tagString否""标签
producerString否"defaultProducer"生产者
deliveryTimestamplong否0延时时间
consumerGroupString否"defaultConsumerGroup"消费者组
consumptionThreadCountint否20消费线程数
maxCacheMessageCountint否1024最大缓存信息数

@MessageKeyopen in new window

  • 描述:消息key注解
属性类型是否必须默认值描述
valueString否""字段名(该值可无)

@SendMessageopen in new window

  • 描述:发送消息注解
AttributesTypeRequiredDefaultDescription
topicString是无topic名称
asyncboolean否false是否异步发送
messageString是""发送消息,支持SPEL表达式
messageKeyString否""消息key,支持SPEL表达式
tagString否""标签
producerString否"defaultProducer"生产者
deliveryTimestamplong否0延时时间

@MessageListeneropen in new window

  • 描述: 消息接收注解
AttributesTypeRequiredDefaultDescription
topicString否无topic名称(与topicPattern必须有一个有值,topicPattern优先级更高)
topicPatternString否无topic正则名称 (与topicPattern必须有一个有值,topicPattern优先级更高)
tagString否""标签
consumerGroupString否"defaultConsumerGroup"消费者组
consumptionThreadCountint否20消费线程数
maxCacheMessageCountint否1024最大缓存信息数