Skip to content

Instantly share code, notes, and snippets.

@mkumm
Created May 10, 2024 11:38
Show Gist options
  • Save mkumm/44201228a601e7b9d8974a3bfc96e4c2 to your computer and use it in GitHub Desktop.
Save mkumm/44201228a601e7b9d8974a3bfc96e4c2 to your computer and use it in GitHub Desktop.
Sample RabbitMQ Producer in Elixir Livebook

Producer

Mix.install([
  {:amqp, "~> 3.3"}
])

Section

options = [host: "localhost", port: 5675, virtual_host: "/", username: "guest", password: "guest"]
{:ok, connection} = AMQP.Connection.open(options)
{:ok, channel} = AMQP.Channel.open(connection)
AMQP.Queue.declare(channel, "sneakers")
AMQP.Basic.publish(channel, "", "sneakers", "Setec Astronomy")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment