spring:
  application:
    name: yutong-mqtt-app
  config:
    import:
      - optional:nacos:${spring.application.name}.${NACOS_CONFIG_FILE_EXTENSION:yml}?group=${NACOS_GROUP:DEFAULT_GROUP}&refreshEnabled=${NACOS_REFRESH_ENABLED:true}
  cloud:
    nacos:
      config:
        enabled: ${NACOS_CONFIG_ENABLED:true}
        server-addr: ${NACOS_SERVER_ADDR:127.0.0.1:8848}
        namespace: ${NACOS_NAMESPACE:}
        group: ${NACOS_GROUP:DEFAULT_GROUP}
        file-extension: ${NACOS_CONFIG_FILE_EXTENSION:yml}
        username: ${NACOS_USERNAME:}
        password: ${NACOS_PASSWORD:}
  threads:
    virtual:
      enabled: true

server:
  port: ${HTTP_PORT:20500}

lingniu:
  ingest:
    mqtt:
      enabled: ${YUTONG_MQTT_ENABLED:false}
      auto-startup: ${YUTONG_MQTT_AUTO_STARTUP:true}
      endpoints:
        - name: ${YUTONG_MQTT_ENDPOINT_NAME:yutong}
          uri: ${YUTONG_MQTT_URI:}
          topic: ${YUTONG_MQTT_TOPIC:#}
          qos: ${YUTONG_MQTT_QOS:1}
          client-id: ${YUTONG_MQTT_CLIENT_ID:lingniu-yutong-mqtt}
          username: ${YUTONG_MQTT_USERNAME:}
          password: ${YUTONG_MQTT_PASSWORD:}
          clean-session: ${YUTONG_MQTT_CLEAN_SESSION:false}
          keep-alive-seconds: ${YUTONG_MQTT_KEEP_ALIVE_SECONDS:20}
          connection-timeout-seconds: ${YUTONG_MQTT_CONNECTION_TIMEOUT_SECONDS:10}
          profile: yutong
          tls:
            ca-pem: ${YUTONG_MQTT_TLS_CA_PEM:}
            client-pem: ${YUTONG_MQTT_TLS_CLIENT_PEM:}
            client-key: ${YUTONG_MQTT_TLS_CLIENT_KEY:}
            hostname-verification-enabled: ${YUTONG_MQTT_TLS_HOSTNAME_VERIFICATION_ENABLED:true}
    pipeline:
      disruptor:
        ring-buffer-size: ${PIPELINE_RING_BUFFER_SIZE:131072}
        wait-strategy: ${PIPELINE_WAIT_STRATEGY:yielding}
        producer-type: multi
      dedup:
        enabled: true
        cache-size: 200000
        ttl-seconds: 600
      rate-limit:
        per-vin-qps: 50
    identity:
      store: mysql
      mysql:
        jdbc-url: ${VEHICLE_IDENTITY_MYSQL_JDBC_URL:jdbc:mysql://127.0.0.1:3306/lingniu_vehicle?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai}
        username: ${VEHICLE_IDENTITY_MYSQL_USERNAME:root}
        password: ${VEHICLE_IDENTITY_MYSQL_PASSWORD:}
        table-name: ${VEHICLE_IDENTITY_MYSQL_TABLE:vehicle_identity_bindings}
        initialize-schema: ${VEHICLE_IDENTITY_MYSQL_INITIALIZE_SCHEMA:true}
    sink:
      kafka:
        enabled: true
        bootstrap-servers: ${KAFKA_BROKERS:114.55.58.251:9092}
        compression-type: zstd
        linger-ms: 20
        batch-size: 65536
        acks: all
        enable-idempotence: true
        node-id: ${KAFKA_NODE_ID:yutong-mqtt-local}
        topics:
          realtime: ${KAFKA_TOPIC_YUTONG_MQTT_EVENT:vehicle.event.mqtt-yutong.v1}
          location: ${KAFKA_TOPIC_YUTONG_MQTT_EVENT:vehicle.event.mqtt-yutong.v1}
          alarm: ${KAFKA_TOPIC_YUTONG_MQTT_EVENT:vehicle.event.mqtt-yutong.v1}
          session: ${KAFKA_TOPIC_YUTONG_MQTT_EVENT:vehicle.event.mqtt-yutong.v1}
          media-meta: ${KAFKA_TOPIC_MEDIA_META:vehicle.media.meta.v1}
          raw-archive: ${KAFKA_TOPIC_YUTONG_MQTT_RAW:vehicle.raw.mqtt-yutong.v1}
          dlq: ${KAFKA_TOPIC_YUTONG_MQTT_DLQ:vehicle.dlq.mqtt-yutong.v1}
        consumer:
          enabled: false
      archive:
        enabled: ${SINK_ARCHIVE_ENABLED:true}
        type: local
        path: ${SINK_ARCHIVE_PATH:./archive/}

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
  endpoint:
    health:
      probes:
        enabled: ${MANAGEMENT_HEALTH_PROBES_ENABLED:true}
  health:
    redis:
      enabled: ${MANAGEMENT_HEALTH_REDIS_ENABLED:false}
  metrics:
    tags:
      application: yutong-mqtt-app

logging:
  level:
    root: INFO
    com.lingniu.ingest: INFO
