Skip to content

Commit 452d88f

Browse files
Elixir streams: do not assume any particular application startup order
1 parent d733250 commit 452d88f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

elixir-stream/README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ Code examples are executed via `elixir`:
1414

1515
Tutorial one: "Hello World!":
1616

17-
elixir publish.exs
18-
elixir consume.exs
17+
``` shell
18+
# run the publisher
19+
elixir publish.exs
20+
21+
# run the consumer
22+
elixir consume.exs
23+
```
1924

2025
To learn more, see [`VictorGaiva/rabbitmq-stream`](https://github.com/VictorGaiva/rabbitmq-stream).

elixir-stream/consume.exs

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Mix.install([
99
# First we start a Connection to the RabbitMQ Server
1010
{:ok, connection} = RabbitMQStream.Connection.start_link()
1111

12-
# We can assume the stream already exists as this sample is meant to be run after the 'publish.exs' sample
12+
# We can assume the stream doesn't exist yet, and attempt to create it. If it already exists,
13+
# it should be still be good to go.
14+
RabbitMQStream.Connection.create_stream(connection, "my_stream")
1315

1416
# Now we can subscribe to the stream, receiving up to 1 chunk.
1517
{:ok, subscription_id} =

0 commit comments

Comments
 (0)