Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

The JetStream.API.Consumer info spec type doesn't match the actual type - lots of missing fields #76

@autodidaddict

Description

@autodidaddict

While trying to use this library to obtain the pending/num_pending count for a given consumer, I noticed that information is advertised in the typespec but not made available at all in the code.

The following code is what I see from the 0.0.6 version:

defp to_info(%{"config" => config, "state" => state, "created" => created} = response) do
    with {:ok, created, _} <- DateTime.from_iso8601(created) do
      %{
        cluster: Map.get(response, "cluster"),
        config: to_stream(config),
        created: created,
        mirror: Map.get(response, "mirror"),
        sources: Map.get(response, "sources"),
        state: to_state(state)
      }
    end
  end

And from the hexdocs the info() type specification:

info() :: %{
  ack_floor: %{consumer_seq: [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), stream_seq: [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()},
  cluster:
    nil
    | %{
        optional(:name) => [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),
        optional(:leader) => [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),
        optional(:replicas) => [
          %{
            :active => [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),
            :current => [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),
            :name => [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),
            optional(:lag) => [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),
            optional(:offline) => [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()
          }
        ]
      },
  [config](https://hexdocs.pm/jetstream/Jetstream.API.Consumer.html#t:config/0): config(),
  created: [DateTime.t](https://hexdocs.pm/elixir/DateTime.html#t:t/0)(),
  delivered: %{consumer_seq: [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), stream_seq: [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()},
  name: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),
  num_ack_pending: [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),
  num_pending: [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),
  num_redelivered: [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),
  num_waiting: [non_neg_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),
  push_bound: nil | [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),
  stream_name: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions