From 423eb336ae6e3b2a3820d75807388d47647711d6 Mon Sep 17 00:00:00 2001 From: Frederico Berger Date: Mon, 6 Apr 2020 15:22:02 -0300 Subject: [PATCH 1/2] Receive options on queue subscribe and pass to basic consume --- lib/amqp/queue.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/amqp/queue.ex b/lib/amqp/queue.ex index c659b62..eeb2424 100644 --- a/lib/amqp/queue.ex +++ b/lib/amqp/queue.ex @@ -202,9 +202,9 @@ defmodule AMQP.Queue do """ @spec subscribe(Channel.t(), Basic.queue(), (String.t(), map -> any)) :: {:ok, String.t()} | Basic.error() - def subscribe(%Channel{} = channel, queue, fun) when is_function(fun, 2) do + def subscribe(%Channel{} = channel, queue, fun, options \\ []) when is_function(fun, 2) do consumer_pid = spawn(fn -> do_start_consumer(channel, fun) end) - Basic.consume(channel, queue, consumer_pid) + Basic.consume(channel, queue, consumer_pid, options) end defp do_start_consumer(channel, fun) do From 514fe08e719d6f0501fb92ac9cae5c8572706404 Mon Sep 17 00:00:00 2001 From: Frederico Berger Date: Wed, 8 Apr 2020 13:51:38 -0300 Subject: [PATCH 2/2] Fix missing function spec at queue subscribe --- lib/amqp/queue.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/amqp/queue.ex b/lib/amqp/queue.ex index eeb2424..e76b086 100644 --- a/lib/amqp/queue.ex +++ b/lib/amqp/queue.ex @@ -200,7 +200,7 @@ defmodule AMQP.Queue do This convenience function will spawn a process and register it using AMQP.Basic.consume. """ - @spec subscribe(Channel.t(), Basic.queue(), (String.t(), map -> any)) :: + @spec subscribe(Channel.t(), Basic.queue(), (String.t(), map -> any), keyword) :: {:ok, String.t()} | Basic.error() def subscribe(%Channel{} = channel, queue, fun, options \\ []) when is_function(fun, 2) do consumer_pid = spawn(fn -> do_start_consumer(channel, fun) end)