consume returns ok
All checks were successful
Build and Publish / build-release (push) Successful in 1m22s
All checks were successful
Build and Publish / build-release (push) Successful in 1m22s
This commit is contained in:
@@ -16,10 +16,13 @@ defmodule PolicyService.Consumers.QuoteTaskConsumer do
|
|||||||
def init(_opts) do
|
def init(_opts) do
|
||||||
{:ok, conn} = AMQP.Connection.open(Application.fetch_env!(:policy_service, :amqp_url))
|
{:ok, conn} = AMQP.Connection.open(Application.fetch_env!(:policy_service, :amqp_url))
|
||||||
{:ok, channel} = AMQP.Channel.open(conn)
|
{:ok, channel} = AMQP.Channel.open(conn)
|
||||||
|
|
||||||
AMQP.Queue.declare(channel, @queue, durable: true)
|
AMQP.Queue.declare(channel, @queue, durable: true)
|
||||||
AMQP.Queue.bind(channel, @queue, @exchange, routing_key: @routing_key)
|
AMQP.Queue.bind(channel, @queue, @exchange, routing_key: @routing_key)
|
||||||
AMQP.Basic.consume(channel, @queue, nil, no_ack: false)
|
{:ok, _tag} = AMQP.Basic.consume(channel, @queue)
|
||||||
|
|
||||||
Logger.info("QuoteTaskConsumer started, listening on #{@queue}")
|
Logger.info("QuoteTaskConsumer started, listening on #{@queue}")
|
||||||
|
|
||||||
{:ok, %{channel: channel}}
|
{:ok, %{channel: channel}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user