server: port: 8081 spring: application: name: redis-stream-demo # 数据库配置 datasource: url: jdbc:h2:mem:testdb driver-class-name: org.h2.Driver username: sa password: hikari: maximum-pool-size: 10 minimum-idle: 5 connection-timeout: 30000 idle-timeout: 600000 max-lifetime: 1800000 # H2数据库控制台 h2: console: enabled: true path: /h2-console # JPA配置 jpa: hibernate: ddl-auto: create-drop show-sql: true properties: hibernate: format_sql: true # 异步任务配置 task: execution: pool: core-size: 5 max-size: 10 queue-capacity: 100 keep-alive: 60s scheduling: pool: size: 5 redis: host: localhost port: 6379 password: database: 0 timeout: 2000ms lettuce: pool: max-active: 8 max-wait: -1ms max-idle: 8 min-idle: 0 # Redis Stream Configuration redis: stream: key: "message-stream" consumer-group: "message-consumer-group" consumer-name: "message-consumer" # 事务消息配置 transactional: # 消息表模式配置 message-table: # 是否启用消息表模式事务消息服务(默认关闭) enabled: false # 是否启用定时任务处理待发送消息(默认关闭) scheduled-processing-enabled: false # 是否启用定时任务重试失败消息(默认关闭) scheduled-retry-enabled: false # 消费者模式配置 consumer: # 默认模式: stream-listener, manual-ack, both default-mode: "both" # 是否启用 StreamListener 模式 stream-listener-enabled: true # 是否启用 Manual Ack 模式 manual-ack-enabled: true # StreamListener 配置 stream-listener: # 是否自动启动 auto-start: false # 是否处理历史消息(true: 从开头读取所有消息,false: 只读取新消息) process-historical-messages: true # 轮询超时时间(秒) poll-timeout: 1 # 线程池核心线程数 core-pool-size: 2 # 线程池最大线程数 max-pool-size: 4 # 线程空闲时间(秒) keep-alive-time: 60 # Manual Ack 配置 manual-ack: # 默认批量大小 default-batch-size: 10 # 最大批量大小 max-batch-size: 100 # 轮询间隔(毫秒) poll-interval: 1000 # 是否启用并发处理 concurrent-processing: false # 最大并发数 max-concurrency: 5 # Application Configuration app: # 是否在启动时运行事务消息示例(默认关闭) run-examples-on-startup: false # Logging Configuration logging: level: com.example: DEBUG org.springframework.data.redis: DEBUG io.lettuce: DEBUG charset: console: UTF-8 file: UTF-8