Closed xuqinghan closed 2 years ago
You should specify advertised_host
in stream plugin's configuration.
The reason for that is when publishing messages, we need to make sure that the client is connected to a writable broker (leader)
You should specify
advertised_host
in stream plugin's configuration.The reason for that is when publishing messages, we need to make sure that the client is connected to a writable broker (leader)
Thanks. I read https://blog.rabbitmq.com/posts/2021/07/connecting-to-streams/ https://www.rabbitmq.com/stream.html
finally follow this https://blog.rabbitmq.com/posts/2021/07/rabbitmq-streams-first-application
docker-compose.yml
version: '3.8'
services:
rabbitmq-stream:
restart: always
#image: rabbitmq-webstomp
build: ./
command: rabbitmq-server
environment:
RABBITMQ_ERLANG_COOKIE: SWQOKODSQALRPCLNMEQG
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: -rabbitmq_stream advertised_host localhost
ports:
- "15672:15672" # mangerment webpage
- "5672:5672" #rabbitmq
- "15674:15674" #web stomp
- "61613:61613" #stomp
- "5552:5552" # stream
add "RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: -rabbitmq_stream advertised_host localhost".
it works.
Thanks!
ubuntu 20.04 + python 3.10 + rabbitMQ 3.9.13 from docker image dockerfile:
docker-compose.yml
run readme demo:
the queue "mystream" is created , http://127.0.0.1:15672/#/queues/%2F/mystream, but "await producer.publish('mystream', amqp_message)" failed