| 12345678910111213141516171819 |
- # -*- coding: utf-8 -*-
- import asyncio
- from rstream import Producer
- STREAM = 'demo-stream'
- USER = 'user'
- PWD = 'Un2yzriWm7veSDoh'
- HOST = 'rabbitmq.rabbitmq.svc.cluster.local'
- async def main():
- producer = Producer(host=HOST, port=5552, username=USER, password=PWD)
- async with producer:
- await producer.create_stream(STREAM)
- for i in range(100_000):
- await producer.send(STREAM, f"msg-{i}".encode())
- print(" [x] Sent 100k messages to stream")
- if __name__ == '__main__':
- asyncio.run(main())
|