PulsarEx.start_consumers
You're seeing just the function
start_consumers
, go back to PulsarEx module for more information.
Link to this function
start_consumers(topic, subscription, callback_module)
Starts the consumers
Examples
iex> defmodule ExampleCallback do
iex> @behaviour PulsarEx.ConsumerCallback
iex>
iex> def handle_messages(msgs, _state) do
iex> msgs |> Enum.map(&{:ack, IO.inspect(&1)})
iex> end
iex> end
iex>
iex> PulsarEx.start_consumers("test-topic", "test-subscription", ExampleCallback)
iex> PulsarEx.stop_consumers("test-topic", "test-subscription")
Available pulserl options:
consumer_name :: string()
priority_level :: non_neg_integer(),
Only works in shared/failover subscription
properties = [] :: keyword() | %{term() => term()}
initial_position = :latest :: :latest | :earliest
subscription_type = :shared :: :shared | :failover | :exclusive | :key_shared
queue_size = 1000 :: non_neg_integer()
acknowledgments_send_tick = 100 :: non_neg_integer()
max_pending_acknowledgments = 1000 :: non_neg_integer()
queue_refill_threshold :: non_neg_integer(),
When to get next batch of messages from broker, default to half of the queue_size
acknowledgment_timeout = 0 :: non_neg_integer(),
Timeout for sending acknowledgments, 0 means infinity.
If any, must be greater than 1_000(1 second)
nack_message_redelivery_delay = 60000 :: non_neg_integer(),
Redeliver delay for nack'ed messages
dead_letter_topic_name :: string()
dead_letter_topic_max_redeliver_count = 0 :: non_neg_integer(),
Max number of times nack'ed messages can be redelivered0 means infinity
Available PulsarEx options:
callback_module,
The module that implements PulsarEx.ConsumerCallback
batch_size = 1 :: non_neg_integer(),
Always consume the messages in batch, indicate the size of each batch, defaults to 1
poll_interval = 100,
How often to poll next batch, defaults to 100 milliseconds
workers = 1,
Number of workers to work on messages, default to 1.
Note in the case of consuming from partitioned topics and with key_shared subscription,
workers is set to be the same as number of partitions
Link to this function
start_consumers(topic, subscription, callback_module, opts)
See PulsarEx.Application.start_consumers/4
.