Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions en/api/@connectum/events-amqp/classes/AmqpConnectionError.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

# Class: AmqpConnectionError

Defined in: [packages/events-amqp/src/errors.ts:42](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L42)
Defined in: [packages/events-amqp/src/errors.ts:45](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L45)

Connection is absent, lost, or recovery is in progress / exhausted.
Publishes during a disconnected window fail fast with this error;
in-flight confirms are rejected with it on connection loss.
Publishes during a disconnected window fail fast with this error (unless
the opt-in `publishRetry` is enabled — connection-class failures are then
retried in place within the AUTO-RETRY boundary, see
`isAutoRetriablePublishError`); in-flight confirms are rejected with it on
connection loss.

## Extends

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Class: AmqpPublishNackError

Defined in: [packages/events-amqp/src/errors.ts:58](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L58)
Defined in: [packages/events-amqp/src/errors.ts:61](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L61)

The broker negatively acknowledged (nacked) a published message.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Class: AmqpPublishTimeoutError

Defined in: [packages/events-amqp/src/errors.ts:65](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L65)
Defined in: [packages/events-amqp/src/errors.ts:68](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L68)

No broker outcome (ack/nack/return/connection loss) arrived within
`publishTimeoutMs`. The message state is UNKNOWN — it may or may not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Class: AmqpSerializationError

Defined in: [packages/events-amqp/src/errors.ts:112](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L112)
Defined in: [packages/events-amqp/src/errors.ts:115](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L115)

Payload encoding/decoding failed in a custom serialization hook.

Expand Down
6 changes: 3 additions & 3 deletions en/api/@connectum/events-amqp/classes/AmqpTopologyError.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Class: AmqpTopologyError

Defined in: [packages/events-amqp/src/errors.ts:93](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L93)
Defined in: [packages/events-amqp/src/errors.ts:96](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L96)

Topology declaration or verification failed: missing exchange/queue in
`check`/`skip` mode, or a conflicting redeclare (PRECONDITION_FAILED) in
Expand All @@ -24,7 +24,7 @@ failure classification (WHY it failed) stays with the error class and

> **new AmqpTopologyError**(`message`, `options?`): `AmqpTopologyError`

Defined in: [packages/events-amqp/src/errors.ts:99](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L99)
Defined in: [packages/events-amqp/src/errors.ts:102](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L102)

#### Parameters

Expand Down Expand Up @@ -92,7 +92,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li

> `readonly` `optional` **object?**: [`AmqpTopologyObject`](../type-aliases/AmqpTopologyObject.md)

Defined in: [packages/events-amqp/src/errors.ts:97](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L97)
Defined in: [packages/events-amqp/src/errors.ts:100](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L100)

***

Expand Down
6 changes: 3 additions & 3 deletions en/api/@connectum/events-amqp/classes/AmqpUnroutableError.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Class: AmqpUnroutableError

Defined in: [packages/events-amqp/src/errors.ts:48](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L48)
Defined in: [packages/events-amqp/src/errors.ts:51](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L51)

The broker returned a `mandatory` message as unroutable
(`basic.return`): no queue is bound for the routing key.
Expand All @@ -17,7 +17,7 @@ The broker returned a `mandatory` message as unroutable

> **new AmqpUnroutableError**(`message`, `routingKey`): `AmqpUnroutableError`

Defined in: [packages/events-amqp/src/errors.ts:51](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L51)
Defined in: [packages/events-amqp/src/errors.ts:54](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L54)

#### Parameters

Expand Down Expand Up @@ -79,7 +79,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li

> `readonly` **routingKey**: `string`

Defined in: [packages/events-amqp/src/errors.ts:49](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L49)
Defined in: [packages/events-amqp/src/errors.ts:52](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L52)

***

Expand Down
2 changes: 1 addition & 1 deletion en/api/@connectum/events-amqp/functions/AmqpAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

> **AmqpAdapter**(`options`): `EventAdapter`

Defined in: [packages/events-amqp/src/AmqpAdapter.ts:442](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/AmqpAdapter.ts#L442)
Defined in: [packages/events-amqp/src/AmqpAdapter.ts:462](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/AmqpAdapter.ts#L462)

Create an AMQP/RabbitMQ adapter for @connectum/events.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[Connectum API Reference](../../../index.md) / [@connectum/events-amqp](../index.md) / isAutoRetriablePublishError

# Function: isAutoRetriablePublishError()

> **isAutoRetriablePublishError**(`err`, `options?`): `boolean`

Defined in: [packages/events-amqp/src/AmqpAdapter.ts:180](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/AmqpAdapter.ts#L180)

The publish AUTO-RETRY boundary (#195): which publish failures the opt-in
`publishRetry` retries inline.

Deliberately NARROWER than the at-least-once REPUBLISH matrix in the error
taxonomy (`errors.ts`): a broker nack is republish-safe by policy but is an
explicit refusal — hammering it in a tight loop is not a retry strategy.
Connection-class outcomes (`AmqpConnectionError`: publish during recovery,
in-flight confirm lost to a drop) are retriable; a timeout
(`AmqpPublishTimeoutError`, state UNKNOWN) joins only via
`retryOnTimeout: true`. Deterministic outcomes (unroutable, serialization,
topology) never retry.

## Parameters

### err

`unknown`

### options?

#### retryOnTimeout?

`boolean`

## Returns

`boolean`
7 changes: 7 additions & 0 deletions en/api/@connectum/events-amqp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
## Functions

- [AmqpAdapter](functions/AmqpAdapter.md)
- [isAutoRetriablePublishError](functions/isAutoRetriablePublishError.md)
- [toAmqpPattern](functions/toAmqpPattern.md)

## References
Expand Down Expand Up @@ -75,6 +76,12 @@ Re-exports [AmqpPublisherOptions](types/interfaces/AmqpPublisherOptions.md)

***

### AmqpPublishRetryOptions

Re-exports [AmqpPublishRetryOptions](types/interfaces/AmqpPublishRetryOptions.md)

***

### AmqpQueueDeclaration

Re-exports [AmqpQueueDeclaration](types/interfaces/AmqpQueueDeclaration.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

> **AmqpTopologyObject** = \{ `kind`: `"exchange"` \| `"queue"`; `name`: `string`; \} \| \{ `destination`: `string`; `destinationType`: `"queue"` \| `"exchange"`; `kind`: `"binding"`; `routingKey`: `string`; `source`: `string`; \}

Defined in: [packages/events-amqp/src/errors.ts:72](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L72)
Defined in: [packages/events-amqp/src/errors.ts:75](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/errors.ts#L75)

Machine-readable identity of the topology object a declaration or
verification failed on. A binding has no name of its own — it is identified
Expand Down
1 change: 1 addition & 0 deletions en/api/@connectum/events-amqp/types/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Configuration types for the AMQP/RabbitMQ adapter.
- [AmqpExchangeOptions](interfaces/AmqpExchangeOptions.md)
- [AmqpLifecycleCallbacks](interfaces/AmqpLifecycleCallbacks.md)
- [AmqpPublisherOptions](interfaces/AmqpPublisherOptions.md)
- [AmqpPublishRetryOptions](interfaces/AmqpPublishRetryOptions.md)
- [AmqpQueueDeclaration](interfaces/AmqpQueueDeclaration.md)
- [AmqpQueueOptions](interfaces/AmqpQueueOptions.md)
- [AmqpQueueOverride](interfaces/AmqpQueueOverride.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ false

> `readonly` `optional` **lifecycle?**: [`AmqpLifecycleCallbacks`](AmqpLifecycleCallbacks.md)

Defined in: [packages/events-amqp/src/types.ts:197](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L197)
Defined in: [packages/events-amqp/src/types.ts:249](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L249)

Connection lifecycle callbacks. Connection errors are surfaced here —
not just logged.
Expand All @@ -120,11 +120,72 @@ Publisher options.

***

### publishRetry?

> `readonly` `optional` **publishRetry?**: `boolean` \| [`AmqpPublishRetryOptions`](AmqpPublishRetryOptions.md)

Defined in: [packages/events-amqp/src/types.ts:243](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L243)

Opt-in bounded publish retry for CONNECTION-CLASS outcomes (since 1.3.0).

When enabled, a `publish()` that fails with `AmqpConnectionError` —
publishing during a recovery window, or an in-flight confirm lost to a
connection drop — is retried in place (the caller's promise stays
pending) instead of rejecting immediately: a short broker blip becomes
a transparent delay. `true` = defaults; an object tunes the budget.

The retry boundary is [isAutoRetriablePublishError](../../functions/isAutoRetriablePublishError.md) — deliberately
NARROWER than the at-least-once republish matrix in the error taxonomy:
a broker `nack` is republish-safe by policy but is NOT auto-retried
inline (it is an explicit broker refusal, e.g. an over-capacity queue —
hammering it in a tight loop helps nobody). `AmqpPublishTimeoutError`
joins the boundary only with `retryOnTimeout: true`.

Semantics — read before enabling:
- **At-least-once, full stop.** A retried publish whose previous attempt
was lost IN FLIGHT (confirm never arrived: state UNKNOWN) may
duplicate on the broker. `x-event-id` / `messageId` stay STABLE across
attempts (also with `externalContract` — a caller-supplied id is
reused as-is), so consumer-side dedup keys on them.
- **Worst-case latency**: each attempt is bounded by `publishTimeoutMs`
(default 30s), so `maxRetries: 5` can hold a single `publish()` for
several minutes worst-case — far beyond typical 30s RPC timeouts.
There is deliberately no second overall-deadline knob: bound the
budget via `maxRetries`/`publishTimeoutMs`.
- **Shutdown-aware**: the loop aborts on `disconnect()` (throws the last
connection error) and, living inside the `adapter.publish()` promise,
is automatically covered by the bus-level `drainPublishTimeout`.
- **Single-flight** (`mandatory: true` with `correlationHeader: false`;
`externalContract` forces the latter but single-flight still requires
`mandatory`): retries hold the chain — ordering is preserved at the
cost of head-of-line blocking during backoff. In this headerless mode
a late `basic.return` from an abandoned timed-out attempt may mark the
current one (correlation is attempt-agnostic without the header) —
prefer the default header correlation when combining `mandatory` with
`retryOnTimeout`.
- **Deterministic channel-close is not retried**: a broker reply with a
`404`/`406` code that killed the publish CHANNEL (e.g. a publish to a
missing exchange under `topologyMode: "skip"`) surfaces immediately
with the broker reply as `cause` — the connection stays up, recovery
never recreates the channel, so retrying cannot heal.

Backoff mirrors the recovery formula (same knob names and semantics,
incl. cap-before-jitter), but the DEFAULT budget differs: `maxRetries`
here defaults to **5** (bounded), not `Infinity`.

#### Default

```ts
undefined (disabled — behavior unchanged)
```

***

### publishTimeoutMs?

> `readonly` `optional` **publishTimeoutMs?**: `number`

Defined in: [packages/events-amqp/src/types.ts:207](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L207)
Defined in: [packages/events-amqp/src/types.ts:259](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L259)

Per-publish broker-outcome deadline in milliseconds. A publish whose
ack/nack/return/connection-loss outcome does not arrive in time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

# Interface: AmqpBindingDeclaration

Defined in: [packages/events-amqp/src/types.ts:267](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L267)
Defined in: [packages/events-amqp/src/types.ts:319](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L319)

## Properties

### arguments?

> `readonly` `optional` **arguments?**: `Record`\<`string`, `unknown`\>

Defined in: [packages/events-amqp/src/types.ts:275](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L275)
Defined in: [packages/events-amqp/src/types.ts:327](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L327)

***

### exchange?

> `readonly` `optional` **exchange?**: `string`

Defined in: [packages/events-amqp/src/types.ts:271](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L271)
Defined in: [packages/events-amqp/src/types.ts:323](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L323)

Destination exchange name (exchange-to-exchange binding).

Expand All @@ -28,7 +28,7 @@ Destination exchange name (exchange-to-exchange binding).

> `readonly` `optional` **queue?**: `string`

Defined in: [packages/events-amqp/src/types.ts:269](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L269)
Defined in: [packages/events-amqp/src/types.ts:321](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L321)

Destination queue name (queue binding) — mutually exclusive with `exchange`.

Expand All @@ -38,14 +38,14 @@ Destination queue name (queue binding) — mutually exclusive with `exchange`.

> `readonly` **routingKey**: `string`

Defined in: [packages/events-amqp/src/types.ts:274](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L274)
Defined in: [packages/events-amqp/src/types.ts:326](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L326)

***

### source

> `readonly` **source**: `string`

Defined in: [packages/events-amqp/src/types.ts:273](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L273)
Defined in: [packages/events-amqp/src/types.ts:325](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L325)

Source exchange.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Interface: AmqpConsumerOptions

Defined in: [packages/events-amqp/src/types.ts:518](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L518)
Defined in: [packages/events-amqp/src/types.ts:603](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L603)

Consumer options.

Expand All @@ -12,7 +12,7 @@ Consumer options.

> `readonly` `optional` **exclusive?**: `boolean`

Defined in: [packages/events-amqp/src/types.ts:532](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L532)
Defined in: [packages/events-amqp/src/types.ts:617](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L617)

Whether the consumer is exclusive to this connection.

Expand All @@ -28,7 +28,7 @@ false

> `readonly` `optional` **prefetch?**: `number`

Defined in: [packages/events-amqp/src/types.ts:525](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L525)
Defined in: [packages/events-amqp/src/types.ts:610](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L610)

Prefetch count (QoS) — how many unacknowledged messages
a consumer can have at a time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

# Interface: AmqpExchangeDeclaration

Defined in: [packages/events-amqp/src/types.ts:249](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L249)
Defined in: [packages/events-amqp/src/types.ts:301](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L301)

## Properties

### arguments?

> `readonly` `optional` **arguments?**: `Record`\<`string`, `unknown`\>

Defined in: [packages/events-amqp/src/types.ts:255](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L255)
Defined in: [packages/events-amqp/src/types.ts:307](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L307)

Raw AMQP arguments passthrough.

Expand All @@ -20,28 +20,28 @@ Raw AMQP arguments passthrough.

> `readonly` `optional` **autoDelete?**: `boolean`

Defined in: [packages/events-amqp/src/types.ts:253](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L253)
Defined in: [packages/events-amqp/src/types.ts:305](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L305)

***

### durable?

> `readonly` `optional` **durable?**: `boolean`

Defined in: [packages/events-amqp/src/types.ts:252](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L252)
Defined in: [packages/events-amqp/src/types.ts:304](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L304)

***

### name

> `readonly` **name**: `string`

Defined in: [packages/events-amqp/src/types.ts:250](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L250)
Defined in: [packages/events-amqp/src/types.ts:302](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L302)

***

### type

> `readonly` **type**: `"headers"` \| `"topic"` \| `"direct"` \| `"fanout"`

Defined in: [packages/events-amqp/src/types.ts:251](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L251)
Defined in: [packages/events-amqp/src/types.ts:303](https://github.com/Connectum-Framework/connectum/blob/main/packages/events-amqp/src/types.ts#L303)
Loading
Loading