Packages
amqp
1.0.3
4.1.1
4.1.0
4.0.0
4.0.0-rc.1
3.3.2
3.3.1
retired
3.3.0
3.2.0
3.1.1
3.1.0
3.0.1
3.0.0
3.0.0-rc.1
2.1.2
2.1.1
2.1.0
2.0.0
2.0.0-rc.2
2.0.0-rc.1
1.6.0
1.5.0
1.4.2
1.4.1
1.4.0
1.4.0-rc.0
1.3.2
1.3.1
1.3.0
1.2.2
1.2.1
1.2.0
1.2.0-rc.0
1.1.1
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-pre.4
1.0.0-pre.3
1.0.0-pre.2
1.0.0-pre.1
0.3.1
0.3.0
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.2.0-pre.2
0.2.0-pre.1
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.6
0.0.5
0.0.4
0.0.3
Idiomatic Elixir client for RabbitMQ.
Current section
Files
Jump to
Current section
Files
lib/amqp/confirm.ex
defmodule AMQP.Confirm do
@moduledoc """
Functions that work with publisher confirms (RabbitMQ extension to AMQP 0.9.1).
"""
import AMQP.Core
alias AMQP.{Basic, Channel}
@doc """
Activates publishing confirmations on the channel.
"""
@spec select(Channel.t) :: :ok | Basic.error
def select(%Channel{pid: pid}) do
case :amqp_channel.call(pid, confirm_select()) do
confirm_select_ok() -> :ok
error -> {:error, error}
end
end
@doc """
Wait until all messages published since the last call have been
either ack'd or nack'd by the broker.
"""
@spec wait_for_confirms(Channel.t) :: boolean | :timeout
def wait_for_confirms(%Channel{pid: pid}) do
:amqp_channel.wait_for_confirms(pid)
end
@doc """
Wait until all messages published since the last call have been
either ack'd or nack'd by the broker, or until timeout elapses.
"""
@spec wait_for_confirms(Channel.t, non_neg_integer) :: boolean | :timeout
def wait_for_confirms(%Channel{pid: pid}, timeout) do
:amqp_channel.wait_for_confirms(pid, timeout)
end
@doc """
Wait until all messages published since the last call have been
either ack'd or nack'd by the broker, or until timeout elapses.
If any of the messages were nack'd, the calling process dies.
"""
@spec wait_for_confirms_or_die(Channel.t) :: true
def wait_for_confirms_or_die(%Channel{pid: pid}) do
:amqp_channel.wait_for_confirms_or_die(pid)
end
@spec wait_for_confirms_or_die(Channel.t, non_neg_integer) :: true
def wait_for_confirms_or_die(%Channel{pid: pid}, timeout) do
:amqp_channel.wait_for_confirms_or_die(pid, timeout)
end
end