bindTopic

suspend fun bindTopic(pattern: String, queueName: String): Result<Unit>(source)

Creates a topic binding between a pattern and a queue.

Topic bindings use AMQP-style wildcard patterns to route messages:

  • * (star) matches exactly ONE segment between dots

  • # (hash) matches ZERO or MORE segments

The pattern is automatically validated before insertion, and the operation is idempotent (safe to call multiple times with the same arguments).

Return

A Result containing Unit on success, or an error if validation fails.

Parameters

pattern

The AMQP-style wildcard pattern for routing key matching. Examples: "logs.", "logs.#", ".error", "#.critical"

queueName

The name of the queue that will receive matching messages.


context(db: QueryExecutor)
suspend fun bindTopic(pattern: String, queueName: String): Result<Unit>(source)

Creates a topic binding between a pattern and a queue.

This is the context version that can be used within a transaction or query executor.

Return

A Result containing Unit on success, or an error if validation fails.

Parameters

pattern

The AMQP-style wildcard pattern for routing key matching.

queueName

The name of the queue that will receive matching messages.


suspend fun bindTopic(patterns: List<String>, queueName: String): Result<Unit>(source)

Creates topic bindings for multiple patterns to a single queue.

This operation is performed atomically within a transaction. Either all bindings are created successfully, or none are.

Return

A Result containing Unit on success, or an error if any binding fails.

Parameters

patterns

A list of AMQP-style wildcard patterns for routing key matching. Examples: listOf("logs.", "logs.#", ".error", "#.critical")

queueName

The name of the queue that will receive matching messages.