2
如何在send.exs文件中指定我的自定義主機文件如果我的應用程序有receive.exs託管在某處?我有一個elixir應用send.exs和另一個應用receive.exs這是鳳凰的應用程序和託管。如何在RabbitMQ中指定用於連接的自定義主機?
send.exs
{:ok, connection} = AMQP.Connection.open
{:ok, channel} = AMQP.Channel.open(connection)
AMQP.Queue.declare(channel, "hello")
AMQP.Basic.publish(channel, "", "hello", msg)
IO.puts " [x] Sent everything"
AMQP.Connection.close(connection)
receive.exs
...
{:ok, connection} = AMQP.Connection.open
{:ok, channel} = AMQP.Channel.open(connection)
AMQP.Queue.declare(channel, "hello")
AMQP.Basic.consume(channel, "hello", nil, no_ack: true)
IO.puts " [*] Waiting for messages. To exit press CTRL+C, CTRL+C"
...
我的回答有幫助嗎?或者是其他解決方案? –
它幫了很多。謝謝 :) –