rabbitmq-tutorials/elixir/send.exs
Jeff Weiss 9f0db0be04
add Elixir tutorial 1
Prior to this commit, the RabbitMQ tutorials contained no Elixir
examples. One _could_ look at the Erlang examples and adapt them, but
that certainly does not result in idiomatic Elixir. This commit adds the
first tutorial and an Elixir project file specifying the `amqp` library
as the dependency for communicating with RabbitMQ via idiomatic Elixir.
2015-12-21 23:43:01 -08:00

7 lines
251 B
Elixir

{:ok, connection} = AMQP.Connection.open
{:ok, channel} = AMQP.Channel.open(connection)
AMQP.Queue.declare(channel, "hello")
AMQP.Basic.publish(channel, "", "hello", "Hello World!")
IO.puts " [x] Sent 'Hello World!'"
AMQP.Connection.close(connection)