RabbitMQ Stream（3.11+ 实验特性） 的最小可运行 demo。
核心要点：
使用 stream 类型队列（x-queue-type: stream）
支持 回溯消费（offset）、大量客户端、高吞吐

pip install rstream



确保 RabbitMQ 已启用 Stream 插件（3.11+ 默认内置）：
kubectl exec -n rabbitmq rabbitmq-0 -- rabbitmq-plugins enable rabbitmq_stream

''' 我使用的情况:
kubectl exec -n rabbitmq rabbitmq-0 -- rabbitmq-plugins enable rabbitmq_stream
Defaulted container "rabbitmq" out of: rabbitmq, prepare-plugins-dir (init)
Enabling plugins on node rabbit@rabbitmq-0.rabbitmq-headless.rabbitmq.svc.cluster.local:
rabbitmq_stream
The following plugins have been configured:
  rabbitmq_auth_backend_ldap
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_peer_discovery_common
  rabbitmq_peer_discovery_k8s
  rabbitmq_prometheus
  rabbitmq_stream
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@rabbitmq-0.rabbitmq-headless.rabbitmq.svc.cluster.local...
The following plugins have been enabled:
  rabbitmq_stream

started 1 plugins.
'''


先启动消费者：
python stream_consumer.py

再启动生产者：
python stream_producer.py