# Spring Cloud Stream RocketMQ Binder 配置
# 订单服务配置

spring:
  application:
    name: erp-order-service

  cloud:
    stream:
      # RocketMQ Binder配置
      rocketmq:
        binder:
          namesrv-addr: ${ROCKETMQ_NAMESRV_ADDR:localhost:9876}
          # 生产者配置
          producer:
            enabled: true
            enable-msg-trace: true
            access-key: rocketmq
            secret-key: rocketmq123
      
      # 绑定器配置
      bindings:
        # 订单输出通道
        orderOutput:
          destination: order-topic
          content-type: application/json
          group: erp-order-producer-group
          binder: rocketmq
        
        # 库存输入通道（接收库存消息）
        inventoryInput:
          destination: inventory-topic
          content-type: application/json
          group: erp-order-consumer-group
          consumer:
            concurrency: 16
            maxAttempts: 3
          binder: rocketmq
        
        # 支付输入通道（接收支付结果）
        paymentInput:
          destination: payment-topic
          content-type: application/json
          group: erp-order-consumer-group
          consumer:
            concurrency: 8
            maxAttempts: 3
          binder: rocketmq

# RocketMQ专用配置
rocketmq:
  namesrv-addr: ${ROCKETMQ_NAMESRV_ADDR:localhost:9876}
  
  producer:
    group: erp-order-producer-group
    retry-times-when-send-failed: 3
    timeout: 3000
    max-message-size: 6291456
  
  consumer:
    group: erp-order-consumer-group
    consume-concurrency: 16
    max-retry-times: 3

# ERP主题配置
erp:
  rocketmq:
    topics:
      order: order-topic
      inventory: inventory-topic
      payment: payment-topic
    consumer:
      groups:
        order-group: erp-order-consumer-group
        inventory-group: erp-inventory-consumer-group
        payment-group: erp-payment-consumer-group

# 服务端口
server:
  port: 8081

# 日志配置
logging:
  level:
    org.apache.rocketmq: INFO
    com.erp.mq: DEBUG
