# `Kombu.Simple.SimpleQueue`
[🔗](https://github.com/hacktobeer/kombu/blob/v0.1.0/lib/kombu/simple.ex#L7)

Simple API for persistent queues.

Wraps a `Kombu.Consumer` and `Kombu.Producer` to offer a familiar queue-like
interface with `put`, `get`, `get_nowait`, `qsize`, `clear`, and `close`.

# `t`

```elixir
@type t() :: %Kombu.Simple.SimpleQueue{
  channel: term(),
  consumer: Kombu.Consumer.t(),
  no_ack: boolean(),
  producer: Kombu.Producer.t(),
  queue: Kombu.Queue.t(),
  state_pid: pid()
}
```

# `clear`

```elixir
@spec clear(t()) :: non_neg_integer()
```

Purges all messages from the queue.

# `close`

```elixir
@spec close(t()) :: :ok
```

Closes the simple queue, cancelling consumers and stopping state agent.

# `empty?`

```elixir
@spec empty?(t()) :: boolean()
```

Returns true if the queue has no messages.

# `get`

```elixir
@spec get(t(), keyword()) :: Kombu.Message.t()
```

Retrieves a message from the queue.

If `block: false`, returns immediately or raises `Kombu.Empty`.
If `block: true`, waits up to `timeout` seconds for a message.

# `get_nowait`

```elixir
@spec get_nowait(t()) :: Kombu.Message.t()
```

Non-blocking retrieval of a message from the queue (`Queue.get`).
Raises `Kombu.Empty` if no message is available.

# `new`

```elixir
@spec new(term(), String.t() | Kombu.Queue.t(), keyword()) :: t()
```

Creates a new `SimpleQueue`.

`channel` can be a `%Kombu.Connection{}` or channel.
`name_or_queue` can be a binary queue name or a `%Kombu.Queue{}` struct.

Options:
- `:no_ack` - whether received messages are automatically acknowledged (default `false`)
- `:queue_opts` - keyword options for creating the queue
- `:queue_args` - queue arguments map
- `:exchange_opts` - exchange options (defaults to `[type: "direct"]`)
- `:serializer` - default serialization format
- `:compression` - default compression format
- `:accept` - accepted content types list

# `put`

```elixir
@spec put(t(), term(), keyword()) :: term()
```

Publishes a message to the queue.

# `qsize`

```elixir
@spec qsize(t()) :: non_neg_integer()
```

Returns the current number of messages in the queue.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
