Module kyu_consumer

This module is responsible for creating and managing queue consumers.

Behaviours: supervisor.

Description

This module is responsible for creating and managing queue consumers.

Data Types

name()

name() = term()

opts()

opts() = #{id := supervisor:child_id(), name := name(), queue := binary(), worker_module := atom(), worker_state := map(), worker_count := integer(), prefetch_count := integer(), commands := list(), duplex := boolean(), channel := kyu_channel:name()}

Function Index

await/1Equivalent to kyu_consumer:await(Name, 60000).
await/2Waits for the consumer to successfully consume its queue.
channel/1Returns the name of the consumer's channel.
check_opts/1Checks the validity of the provided consumer options.
child_spec/2Returns a consumer child spec.
connection/1Returns the name of the consumer's connection.
queue/1Returns the name of the consumer's queue.
start_link/2Starts a consumer.
stop/1Gracefully stops the consumer.
where/1Returns the pid of the consumer.

Function Details

await/1

await(Name::name()) -> ok

Equivalent to kyu_consumer:await(Name, 60000).

await/2

await(Name::name(), Timeout::timeout()) -> ok

Waits for the consumer to successfully consume its queue.

channel/1

channel(Name::name()) -> kyu_channel:name()

Returns the name of the consumer's channel.

check_opts/1

check_opts(Opts::opts()) -> ok

throws badmatch

Checks the validity of the provided consumer options.

child_spec/2

child_spec(Connection::kyu_connection:name(), Opts::opts()) -> supervisor:child_spec()

Returns a consumer child spec.

connection/1

connection(Name::name()) -> kyu_connection:name()

Returns the name of the consumer's connection.

queue/1

queue(Name::name()) -> binary()

Returns the name of the consumer's queue.

start_link/2

start_link(Connection::kyu_connection:name(), Opts::opts()) -> {ok, pid()} | {error, term()}

Starts a consumer.

stop/1

stop(Name::name()) -> ok

Gracefully stops the consumer.

where/1

where(Name) -> any()

Returns the pid of the consumer. -spec where(Name :: name()) -> pid() | undefined.


Generated by EDoc