Skip to main content Link Search Menu Expand Document (external link)

JetStreamSubscriber overview

Added in v0.1.0


Table of contents


constructors

fromConsumer

Create a JetStreamSubscriber from an existing Consumer.

This is a convenience constructor that internally calls consume() on the consumer.

Signature

export declare const fromConsumer: (
  consumer: JetStreamConsumer.Consumer,
  options?: JetStreamSubscriberOptions,
  consumeOptions?: Parameters<JetStreamConsumer.Consumer["consume"]>[0]
) => Effect.Effect<
  JetStreamSubscriber,
  NATSError.JetStreamConsumerError | NATSError.NATSConnectionError,
  NATSConnection.NATSConnection
>

Added in v0.1.0

fromConsumerMessages

Create a JetStreamSubscriber from an existing ConsumerMessages and Consumer.

This constructor is useful when you want to control the consumer lifecycle separately from the subscriber.

Signature

export declare const fromConsumerMessages: (
  consumerMessages: JetStreamConsumer.ConsumerMessages,
  consumer: JetStreamConsumer.InfoableConsumer,
  options?: JetStreamSubscriberOptions
) => Effect.Effect<JetStreamSubscriber, NATSError.NATSConnectionError, NATSConnection.NATSConnection>

Added in v0.1.0

layers

layer

Layer for providing the current JetStream message to a handler

Signature

export declare const layer: (
  message: JetStreamMessage.JetStreamMessage
) => Layer.Layer<JetStreamMessage.JetStreamMessage>

Added in v0.1.0

models

JetStreamSubscriber (interface)

Signature

export interface JetStreamSubscriber extends Subscriber.Subscriber<JetStreamMessage.JetStreamMessage> {
  readonly [TypeId]: TypeId
}

Added in v0.1.0

JetStreamSubscriberOptions (interface)

Signature

export interface JetStreamSubscriberOptions {
  uninterruptible?: boolean
  handlerTimeout?: Duration.DurationInput
}

Added in v0.1.0

tags

JetStreamConsumeMessage

Context tag for accessing the current JetStream message in a handler

Signature

export declare const JetStreamConsumeMessage: Context.Tag<
  JetStreamMessage.JetStreamMessage,
  JetStreamMessage.JetStreamMessage
>

Added in v0.1.0

type ids

TypeId

Signature

export declare const TypeId: typeof TypeId

Added in v0.1.0

TypeId (type alias)

Signature

export type TypeId = typeof TypeId

Added in v0.1.0