NATSSubscriber overview
Added in v0.3.0
Table of contents
constructors
fromSubscription
Create a NATSSubscriber from an existing NATSSubscription.
Note: NATS Core subscriptions are fire-and-forget. Messages are not persisted and there is no acknowledgment mechanism. If the handler fails or times out, the message is lost.
Signature
export declare const fromSubscription: (
subscription: NATSSubscription.NATSSubscription,
options?: NATSSubscriberOptions
) => Effect.Effect<NATSSubscriber, NATSError.NATSConnectionError, NATSConnection.NATSConnection>
Added in v0.3.0
make
Create a NATSSubscriber by subscribing to a subject.
This is a convenience constructor that internally calls subscribe() on the connection.
Note: NATS Core subscriptions are fire-and-forget. Messages are not persisted and there is no acknowledgment mechanism. If the handler fails or times out, the message is lost.
Signature
export declare const make: (
subject: string,
subscriptionOptions?: NATSCore.SubscriptionOptions,
options?: NATSSubscriberOptions
) => Effect.Effect<NATSSubscriber, NATSError.NATSConnectionError, NATSConnection.NATSConnection>
Added in v0.3.0
layers
layer
Layer for providing the current NATS message to a handler
Signature
export declare const layer: (message: NATSMessage.NATSMessage) => Layer.Layer<NATSMessage.NATSMessage>
Added in v0.3.0
models
NATSSubscriber (interface)
Signature
export interface NATSSubscriber extends Subscriber.Subscriber<NATSMessage.NATSMessage> {
readonly [TypeId]: TypeId
}
Added in v0.3.0
NATSSubscriberOptions (interface)
Signature
export interface NATSSubscriberOptions {
uninterruptible?: boolean
handlerTimeout?: Duration.DurationInput
}
Added in v0.3.0
tags
NATSConsumeMessage
Context tag for accessing the current NATS message in a handler
Signature
export declare const NATSConsumeMessage: Context.Tag<NATSMessage.NATSMessage, NATSMessage.NATSMessage>
Added in v0.3.0
type ids
TypeId
Signature
export declare const TypeId: typeof TypeId
Added in v0.3.0
TypeId (type alias)
Signature
export type TypeId = typeof TypeId
Added in v0.3.0