@relaybus/rabbitmq 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +241 -225
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +242 -227
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import { NonRetryableError, RelayBusError, EventHeaders, EventEnvelope, RetryPolicyOptions, Duration, RelayBusLogger,
|
|
3
|
-
import { JsonEnvelopeMapping } from '@relaybus/core/internal';
|
|
2
|
+
import { NonRetryableError, RelayBusError, EventHeaders, EventEnvelope, RetryPolicyOptions, Duration, RelayBusLogger, CloseOptions } from '@relaybus/core';
|
|
3
|
+
import { JsonEnvelopeMapping, SubscribingTransport, TransportSubscription } from '@relaybus/core/internal';
|
|
4
4
|
export { fromHeader, fromPayloadField } from '@relaybus/core/internal';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -296,6 +296,12 @@ type RabbitMqJsonEnvelopeMapping = JsonEnvelopeMapping<'message-id-property'>;
|
|
|
296
296
|
* @throws ConfigurationError for an incomplete or self-overlapping mapping.
|
|
297
297
|
*/
|
|
298
298
|
declare function jsonEnvelope(mapping: RabbitMqJsonEnvelopeMapping): RabbitMqCodec;
|
|
299
|
+
/**
|
|
300
|
+
* The event a {@link RabbitMqTransport} with `codec` hands to the bus for `message`: the codec's
|
|
301
|
+
* `decode`, with what it leaves out filled in (see `DecodedEvent`). Throws for a malformed
|
|
302
|
+
* message. For codec contract tests (`rabbitMqCodecContract` of `@relaybus/testing`).
|
|
303
|
+
*/
|
|
304
|
+
declare function decodeRabbitMqMessage(codec: RabbitMqCodec, message: AmqpMessage): EventEnvelope;
|
|
299
305
|
|
|
300
306
|
/** Connection settings accepted by `amqplib.connect`, given as an object instead of a URL. */
|
|
301
307
|
interface BrokerConnectionSettings {
|
|
@@ -458,7 +464,7 @@ interface ConnectOptions {
|
|
|
458
464
|
* consumer. Events published meanwhile are rejected, and therefore retried by
|
|
459
465
|
* the outbox, rather than buffered in memory.
|
|
460
466
|
*/
|
|
461
|
-
declare class RabbitMqTransport
|
|
467
|
+
declare class RabbitMqTransport extends SubscribingTransport {
|
|
462
468
|
#private;
|
|
463
469
|
readonly name: string;
|
|
464
470
|
readonly system = "rabbitmq";
|
|
@@ -492,7 +498,7 @@ declare class RabbitMqTransport implements Transport {
|
|
|
492
498
|
* to `onMessage`. Call it once per transport; give each subscription its own
|
|
493
499
|
* transport instance, with its own `name` and `consumerGroup`.
|
|
494
500
|
*/
|
|
495
|
-
|
|
501
|
+
protected openSubscription({ destinations, onMessage, hooks, }: TransportSubscription): Promise<void>;
|
|
496
502
|
/**
|
|
497
503
|
* Stops consuming, waits up to `shutdownTimeout` for running handlers
|
|
498
504
|
* (messages still being retried go back to the queue), then closes the
|
|
@@ -502,4 +508,5 @@ declare class RabbitMqTransport implements Transport {
|
|
|
502
508
|
close(options?: CloseOptions): Promise<void>;
|
|
503
509
|
}
|
|
504
510
|
|
|
505
|
-
export {
|
|
511
|
+
export { AmqpLimitExceededError, MalformedMessageError, RabbitMqPublishRejectedError, RabbitMqTransport, RabbitMqUnavailableError, RabbitMqUnencodableEventError, UnroutableMessageError, UnserializablePayloadError, cloudEventsBinary, cloudEventsStructured, decodeCloudEvent, decodeRabbitMqMessage, jsonEnvelope, plainJsonDecoder };
|
|
512
|
+
export type { AmqpChannel, AmqpConfirmChannel, AmqpConnection, AmqpMessage, AmqpMessageProperties, AmqpPublishOptions, BrokerConnectionSettings, DecodedEvent, EncodedMessage, PlainJsonDecoderOptions, PlainJsonMessage, RabbitMqCodec, RabbitMqJsonEnvelopeMapping, RabbitMqMessageDecoder, RabbitMqTransportOptions, ReconnectOptions, RedeliveryOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import { NonRetryableError, RelayBusError, EventHeaders, EventEnvelope, RetryPolicyOptions, Duration, RelayBusLogger,
|
|
3
|
-
import { JsonEnvelopeMapping } from '@relaybus/core/internal';
|
|
2
|
+
import { NonRetryableError, RelayBusError, EventHeaders, EventEnvelope, RetryPolicyOptions, Duration, RelayBusLogger, CloseOptions } from '@relaybus/core';
|
|
3
|
+
import { JsonEnvelopeMapping, SubscribingTransport, TransportSubscription } from '@relaybus/core/internal';
|
|
4
4
|
export { fromHeader, fromPayloadField } from '@relaybus/core/internal';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -296,6 +296,12 @@ type RabbitMqJsonEnvelopeMapping = JsonEnvelopeMapping<'message-id-property'>;
|
|
|
296
296
|
* @throws ConfigurationError for an incomplete or self-overlapping mapping.
|
|
297
297
|
*/
|
|
298
298
|
declare function jsonEnvelope(mapping: RabbitMqJsonEnvelopeMapping): RabbitMqCodec;
|
|
299
|
+
/**
|
|
300
|
+
* The event a {@link RabbitMqTransport} with `codec` hands to the bus for `message`: the codec's
|
|
301
|
+
* `decode`, with what it leaves out filled in (see `DecodedEvent`). Throws for a malformed
|
|
302
|
+
* message. For codec contract tests (`rabbitMqCodecContract` of `@relaybus/testing`).
|
|
303
|
+
*/
|
|
304
|
+
declare function decodeRabbitMqMessage(codec: RabbitMqCodec, message: AmqpMessage): EventEnvelope;
|
|
299
305
|
|
|
300
306
|
/** Connection settings accepted by `amqplib.connect`, given as an object instead of a URL. */
|
|
301
307
|
interface BrokerConnectionSettings {
|
|
@@ -458,7 +464,7 @@ interface ConnectOptions {
|
|
|
458
464
|
* consumer. Events published meanwhile are rejected, and therefore retried by
|
|
459
465
|
* the outbox, rather than buffered in memory.
|
|
460
466
|
*/
|
|
461
|
-
declare class RabbitMqTransport
|
|
467
|
+
declare class RabbitMqTransport extends SubscribingTransport {
|
|
462
468
|
#private;
|
|
463
469
|
readonly name: string;
|
|
464
470
|
readonly system = "rabbitmq";
|
|
@@ -492,7 +498,7 @@ declare class RabbitMqTransport implements Transport {
|
|
|
492
498
|
* to `onMessage`. Call it once per transport; give each subscription its own
|
|
493
499
|
* transport instance, with its own `name` and `consumerGroup`.
|
|
494
500
|
*/
|
|
495
|
-
|
|
501
|
+
protected openSubscription({ destinations, onMessage, hooks, }: TransportSubscription): Promise<void>;
|
|
496
502
|
/**
|
|
497
503
|
* Stops consuming, waits up to `shutdownTimeout` for running handlers
|
|
498
504
|
* (messages still being retried go back to the queue), then closes the
|
|
@@ -502,4 +508,5 @@ declare class RabbitMqTransport implements Transport {
|
|
|
502
508
|
close(options?: CloseOptions): Promise<void>;
|
|
503
509
|
}
|
|
504
510
|
|
|
505
|
-
export {
|
|
511
|
+
export { AmqpLimitExceededError, MalformedMessageError, RabbitMqPublishRejectedError, RabbitMqTransport, RabbitMqUnavailableError, RabbitMqUnencodableEventError, UnroutableMessageError, UnserializablePayloadError, cloudEventsBinary, cloudEventsStructured, decodeCloudEvent, decodeRabbitMqMessage, jsonEnvelope, plainJsonDecoder };
|
|
512
|
+
export type { AmqpChannel, AmqpConfirmChannel, AmqpConnection, AmqpMessage, AmqpMessageProperties, AmqpPublishOptions, BrokerConnectionSettings, DecodedEvent, EncodedMessage, PlainJsonDecoderOptions, PlainJsonMessage, RabbitMqCodec, RabbitMqJsonEnvelopeMapping, RabbitMqMessageDecoder, RabbitMqTransportOptions, ReconnectOptions, RedeliveryOptions };
|