kafka-solon-cloud-plugin
<dependency>
    <groupId>org.noear</groupId>
    <artifactId>kafka-solon-cloud-plugin</artifactId>
</dependency>
1、描述
分布式扩展插件。基于 kafka client 适配的 solon cloud 插件。提供事件总线服务。
2、能力支持
| 云端能力接口 | 说明 | 备注 | 
|---|---|---|
| CloudEventService | 云端事件服务 | 不支持 namespace;不支持 group | 
3、配置示例
简要配置
solon.app:
  group: demo       #配置服务使用的默认组
  name: helloproducer    #发现服务使用的应用名
solon.cloud.kafka.event:
  server: "192.168.199.182:9092"
更多的可选配置
solon.app:
  group: demo       #配置服务使用的默认组
  name: helloproducer    #发现服务使用的应用名
solon.cloud.kafka.event:
  server: "192.168.199.182:9092"
  username: "your_username" # v2.9.0 后支持(自动转为 sasl plain 登录属性配置)
  password: "your_password" # v2.9.0 后支持
  publishTimeout: 3000 #单位:ms
  producer:  #生产者属性(参考 org.apache.kafka.clients.producer.ProducerConfig 里的配置项)
      acks: "all"
      retries: 0
      batch.size: 16384
  consumer: #消费者属性(参考 org.apache.kafka.clients.consumer.ConsumerConfig 里的配置项)
      enable.auto.commit: true
      auto.commit.interval.ms: 1000
      session.timeout.ms: 30000
      max.poll.records: 100
      auto.offset.reset: "earliest"
      group.id: "${solon.app.group}_${solon.app.name}"
  properties:  #消费者与生产者的公共属性 #v2.9.0 后支持(下面这段为示例,与 username 配置等效)
      security.protocol: SASL_PLAINTEXT
      sasl.mechanism: PLAIN
      sasl.jaas.config: "org.apache.kafka.common.security.plain.PlainLoginModule required username='your_username' password='your_password';"
v2.9.0 之前:连接账号原始风格配置,可在 producer、consumer 下面分别添加属性。示例:
solon.cloud.kafka.event:
  producer:  # 其它部分略过了
    security.protocol: SASL_PLAINTEXT
    sasl.mechanism: PLAIN
    sasl.jaas.config: "org.apache.kafka.common.security.plain.PlainLoginModule required username='your_username' password='your_password';"
4、应用示例
//订阅
@CloudEvent(topic="hello.demo2", group = "test")
public class EVENT_hello_demo2 implements CloudEventHandler {
    @Override
    public boolean handle(Event event) throws Throwable {
        System.out.println(LocalDateTime.now() + ONode.stringify(event));
        return true;
    }
}
//发布(找个地方安放一下)
Event event = new Event("hello.demo2", msg).group("test");
return CloudClient.event().publish(event);