-
-
Save dersar00/3ddc29c27c55e5f9bd77c53852e5cd2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Receive do | |
use MethodMissing | |
def wait_for_messages do | |
receive do | |
{:basic_deliver, payload, meta} -> | |
IO.puts " [x] Received #{payload}" | |
#IO.inspect meta.headers | |
Friends.PersonController.save() | |
wait_for_messages() | |
end | |
end | |
end | |
{:ok, connection} = AMQP.Connection.open | |
{:ok, channel} = AMQP.Channel.open(connection) | |
AMQP.Queue.declare(channel, "queue", durable: true) | |
AMQP.Basic.consume(channel, "queue", nil, no_ack: true) | |
AMQP.Exchange.declare(channel, "default_project", :topic, durable: true) | |
IO.puts " [*] Waiting for messages. To exit press CTRL+C" | |
Receive.wait_for_messages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment