انتقل إلى المحتوى الرئيسي

Class: OktoidTransportStrategy

Defined in: packages/messaging/src/nest.ts:33

The Nest transport for the broker (D8). Our wire is not Nest's: the body is exactly the registered schema, the envelope is in headers, the reply is Reply<T>, and none of Nest's {pattern, data, id} wrapping exists. So this strategy does not use Nest's NATS server; it starts serveBroker and lets Nest own the lifecycle.

Handlers may be given to the receiver directly, or declared as @MessagePattern('request.*.identity.subject.get.v1') methods: at listen() each Nest handler is bound to the receiver as a handler of that key, called with (body, context) and returning a Reply.

Extends​

  • Server

Implements​

  • CustomTransportStrategy

Constructors​

Constructor​

new OktoidTransportStrategy(options): OktoidTransportStrategy

Defined in: packages/messaging/src/nest.ts:37

Parameters​

options​

OktoidTransportOptions

Returns​

OktoidTransportStrategy

Overrides​

Server.constructor

Properties​

_status$​

protected _status$: ReplaySubject<string>

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:29

Inherited from​

Server._status$


deserializer​

protected deserializer: ConsumerDeserializer

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:26

Inherited from​

Server.deserializer


logger​

protected readonly logger: LoggerService

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:17

Inherited from​

Server.logger


messageHandlers​

protected readonly messageHandlers: Map<string, MessageHandler<any, any, any>>

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:16

Inherited from​

Server.messageHandlers


onProcessingEndHook​

protected onProcessingEndHook: (transportId, context) => void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:28

Parameters​

transportId​

symbol | Transport

context​

BaseRpcContext

Returns​

void

Inherited from​

Server.onProcessingEndHook


onProcessingStartHook​

protected onProcessingStartHook: (transportId, context, done) => void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:27

Parameters​

transportId​

symbol | Transport

context​

BaseRpcContext

done​

() => Promise<any>

Returns​

void

Inherited from​

Server.onProcessingStartHook


propagatesEventHandlerErrors​

readonly propagatesEventHandlerErrors: boolean

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:24

Whether this transport hands an event handler failure to its client library, which then reports it. The base handleEvent connects the stream without subscribing, so nothing observes the failure and Nest logs it instead. ServerKafka awaits the stream and sets this to true.

Inherited from​

Server.propagatesEventHandlerErrors


serializer​

protected serializer: ConsumerSerializer

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:25

Inherited from​

Server.serializer


transportId?​

optional transportId?: symbol | Transport

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:15

Unique transport identifier.

Implementation of​

CustomTransportStrategy.transportId

Inherited from​

Server.transportId

Accessors​

status​

Get Signature​

get status(): Observable<Status>

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:33

Returns an observable that emits status changes.

Returns​

Observable<Status>

Inherited from​

Server.status

Methods​

addHandler()​

addHandler(pattern, callback, isEventHandler?, extras?): void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:67

Parameters​

pattern​

any

callback​

MessageHandler

isEventHandler?​

boolean

extras?​

Record<string, any>

Returns​

void

Inherited from​

Server.addHandler


close()​

close(): void

Defined in: packages/messaging/src/nest.ts:68

Stops serving. The connection is drained by whoever opened it.

Returns​

void

Implementation of​

CustomTransportStrategy.close

Overrides​

Server.close


createProcessingEndHookRunner()​

protected createProcessingEndHookRunner(context): () => void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:98

Returns a function that runs the processing end hook exactly once.

An event handler can fail either by rejecting or by returning a stream that errors, and ServerKafka#handleEvent awaits that stream, so both the finalize teardown and the catch block can be reached for a single event. The hook closes a span, so it must not run twice.

Parameters​

context​

BaseRpcContext

Returns​

() => void

Inherited from​

Server.createProcessingEndHookRunner


getHandlerByPattern()​

getHandlerByPattern(pattern): MessageHandler<any, any, any> | null

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:69

Parameters​

pattern​

string

Returns​

MessageHandler<any, any, any> | null

Inherited from​

Server.getHandlerByPattern


getHandlers()​

getHandlers(): Map<string, MessageHandler<any, any, any>>

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:68

Returns​

Map<string, MessageHandler<any, any, any>>

Inherited from​

Server.getHandlers


getOptionsProp()​

Call Signature​

getOptionsProp<Options, Attribute>(obj, prop): Options[Attribute]

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:101

Type Parameters​
Options​

Options extends Record<string, any> | { channelOptions?: ChannelOptions; credentials?: any; gracefulShutdown?: boolean; keepalive?: { http2MaxPingStrikes?: number; http2MaxPingsWithoutData?: number; http2MinPingIntervalWithoutDataMs?: number; http2MinTimeBetweenPingsMs?: number; keepalivePermitWithoutCalls?: number; keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; }; loader?: { alternateCommentMode?: boolean; arrays?: boolean; bytes?: Function; defaults?: boolean; enums?: Function; includeDirs?: string[]; json?: boolean; keepCase?: boolean; longs?: Function; objects?: boolean; oneofs?: boolean; }; maxMetadataSize?: number; maxReceiveMessageLength?: number; maxSendMessageLength?: number; onLoadPackageDefinition?: (pkg, server) => void; package: string | string[]; packageDefinition?: any; protoLoader?: string; protoPath?: string | string[]; url?: string; } | { deserializer?: Deserializer<any, any>; host?: string; incompleteMessageTimeout?: number; maxBufferSize?: number; maxSendBufferSize?: number; port?: number; retryAttempts?: number; retryDelay?: number; serializer?: Serializer<any, any>; socketClass?: Type<TcpSocket>; tlsOptions?: TlsOptions; } | object & IORedisOptions | {[key: string]: any; authenticator?: any; debug?: boolean; deserializer?: Deserializer<any, any>; encoding?: string; gracefulShutdown?: boolean; gracePeriod?: number; headers?: Record<string, string>; ignoreClusterUpdates?: boolean; inboxPrefix?: string; maxPingOut?: number; maxReconnectAttempts?: number; name?: string; nkey?: any; noEcho?: boolean; nonceSigner?: any; noRandomize?: boolean; pass?: string; pedantic?: boolean; pingInterval?: number; preserveBuffers?: boolean; queue?: string; reconnect?: boolean; reconnectDelayHandler?: any; reconnectJitter?: number; reconnectJitterTLS?: number; reconnectTimeWait?: number; serializer?: Serializer<any, any>; servers?: string | string[]; timeout?: number; tls?: any; token?: string; tokenHandler?: any; useOldRequestStyle?: boolean; user?: string; userCreds?: any; userJWT?: string; verbose?: boolean; waitOnFirstConnect?: boolean; yieldTime?: number; } | MqttClientOptions & object | { consumerTag?: string; deserializer?: Deserializer<any, any>; exchange?: string; exchangeArguments?: Record<string, string>; exchangeType?: "topic" | string & object | "headers" | "direct" | "fanout"; headers?: Record<string, string>; isGlobalPrefetchCount?: boolean; maxConnectionAttempts?: number; noAck?: boolean; noAssert?: boolean; persistent?: boolean; prefetchCount?: number; queue?: string; queueOptions?: AmqplibQueueOptions; replyQueue?: string; routingKey?: string; serializer?: Serializer<any, any>; socketOptions?: AmqpConnectionManagerSocketOptions; urls?: string[] | RmqUrl[]; wildcards?: boolean; } | { client?: KafkaConfig; consumer?: ConsumerConfig; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; postfixId?: string; producer?: ProducerConfig; producerOnlyMode?: boolean; run?: Omit<ConsumerRunConfig, "eachBatch" | "eachMessage">; send?: Omit<ProducerRecord, "topic" | "messages">; serializer?: Serializer<any, any>; subscribe?: Omit<ConsumerSubscribeTopics, "topics">; } | undefined

Attribute​

Attribute extends string | number | symbol

Parameters​
obj​

Options

prop​

Attribute

Returns​

Options[Attribute]

Inherited from​

Server.getOptionsProp

Call Signature​

getOptionsProp<Options, Attribute, DefaultValue>(obj, prop, defaultValue): Required<Options>[Attribute]

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:102

Type Parameters​
Options​

Options extends Record<string, any> | { channelOptions?: ChannelOptions; credentials?: any; gracefulShutdown?: boolean; keepalive?: { http2MaxPingStrikes?: number; http2MaxPingsWithoutData?: number; http2MinPingIntervalWithoutDataMs?: number; http2MinTimeBetweenPingsMs?: number; keepalivePermitWithoutCalls?: number; keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; }; loader?: { alternateCommentMode?: boolean; arrays?: boolean; bytes?: Function; defaults?: boolean; enums?: Function; includeDirs?: string[]; json?: boolean; keepCase?: boolean; longs?: Function; objects?: boolean; oneofs?: boolean; }; maxMetadataSize?: number; maxReceiveMessageLength?: number; maxSendMessageLength?: number; onLoadPackageDefinition?: (pkg, server) => void; package: string | string[]; packageDefinition?: any; protoLoader?: string; protoPath?: string | string[]; url?: string; } | { deserializer?: Deserializer<any, any>; host?: string; incompleteMessageTimeout?: number; maxBufferSize?: number; maxSendBufferSize?: number; port?: number; retryAttempts?: number; retryDelay?: number; serializer?: Serializer<any, any>; socketClass?: Type<TcpSocket>; tlsOptions?: TlsOptions; } | object & IORedisOptions | {[key: string]: any; authenticator?: any; debug?: boolean; deserializer?: Deserializer<any, any>; encoding?: string; gracefulShutdown?: boolean; gracePeriod?: number; headers?: Record<string, string>; ignoreClusterUpdates?: boolean; inboxPrefix?: string; maxPingOut?: number; maxReconnectAttempts?: number; name?: string; nkey?: any; noEcho?: boolean; nonceSigner?: any; noRandomize?: boolean; pass?: string; pedantic?: boolean; pingInterval?: number; preserveBuffers?: boolean; queue?: string; reconnect?: boolean; reconnectDelayHandler?: any; reconnectJitter?: number; reconnectJitterTLS?: number; reconnectTimeWait?: number; serializer?: Serializer<any, any>; servers?: string | string[]; timeout?: number; tls?: any; token?: string; tokenHandler?: any; useOldRequestStyle?: boolean; user?: string; userCreds?: any; userJWT?: string; verbose?: boolean; waitOnFirstConnect?: boolean; yieldTime?: number; } | MqttClientOptions & object | { consumerTag?: string; deserializer?: Deserializer<any, any>; exchange?: string; exchangeArguments?: Record<string, string>; exchangeType?: "topic" | string & object | "headers" | "direct" | "fanout"; headers?: Record<string, string>; isGlobalPrefetchCount?: boolean; maxConnectionAttempts?: number; noAck?: boolean; noAssert?: boolean; persistent?: boolean; prefetchCount?: number; queue?: string; queueOptions?: AmqplibQueueOptions; replyQueue?: string; routingKey?: string; serializer?: Serializer<any, any>; socketOptions?: AmqpConnectionManagerSocketOptions; urls?: string[] | RmqUrl[]; wildcards?: boolean; } | { client?: KafkaConfig; consumer?: ConsumerConfig; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; postfixId?: string; producer?: ProducerConfig; producerOnlyMode?: boolean; run?: Omit<ConsumerRunConfig, "eachBatch" | "eachMessage">; send?: Omit<ProducerRecord, "topic" | "messages">; serializer?: Serializer<any, any>; subscribe?: Omit<ConsumerSubscribeTopics, "topics">; } | undefined

Attribute​

Attribute extends string | number | symbol

DefaultValue​

DefaultValue = Options[Attribute]

Parameters​
obj​

Options

prop​

Attribute

defaultValue​

DefaultValue

Returns​

Required<Options>[Attribute]

Inherited from​

Server.getOptionsProp


getPatternAsString()​

protected getPatternAsString(pattern): string

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:126

Returns the string representation of an incoming message pattern.

Patterns are client-controlled: serializing a deeply nested one makes JSON.stringify throw a RangeError, which must not escape the message handler (as an unhandled promise rejection that terminates the process).

Parameters​

pattern​

unknown

client pattern

Returns​

string

string

Inherited from​

Server.getPatternAsString


getRouteFromPattern()​

protected getRouteFromPattern(pattern): string

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:114

Transforms the server Pattern to valid type and returns a route for him.

Parameters​

pattern​

string

server pattern

Returns​

string

string

Inherited from​

Server.getRouteFromPattern


handleError()​

protected handleError(error): void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:103

Parameters​

error​

string

Returns​

void

Inherited from​

Server.handleError


handleEvent()​

handleEvent(pattern, packet, context): Promise<any>

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:71

Parameters​

pattern​

string

packet​

ReadPacket

context​

BaseRpcContext

Returns​

Promise<any>

Inherited from​

Server.handleEvent


handleRequest()​

protected handleRequest(context, produce, respond): void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:77

Handles a request-response message. produce returns the response stream, whose values are replied through respond, and the processing end hook runs once that stream settles (or once produce rejects).

Parameters​

context​

BaseRpcContext

produce​

() => Promise<Observable<any>>

respond​

(data) => void | Promise<unknown>

Returns​

void

Inherited from​

Server.handleRequest


initializeDeserializer()​

protected initializeDeserializer(options): void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:107

Parameters​

options​

{ channelOptions?: ChannelOptions; credentials?: any; gracefulShutdown?: boolean; keepalive?: { http2MaxPingStrikes?: number; http2MaxPingsWithoutData?: number; http2MinPingIntervalWithoutDataMs?: number; http2MinTimeBetweenPingsMs?: number; keepalivePermitWithoutCalls?: number; keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; }; loader?: { alternateCommentMode?: boolean; arrays?: boolean; bytes?: Function; defaults?: boolean; enums?: Function; includeDirs?: string[]; json?: boolean; keepCase?: boolean; longs?: Function; objects?: boolean; oneofs?: boolean; }; maxMetadataSize?: number; maxReceiveMessageLength?: number; maxSendMessageLength?: number; onLoadPackageDefinition?: (pkg, server) => void; package: string | string[]; packageDefinition?: any; protoLoader?: string; protoPath?: string | string[]; url?: string; } | object & IORedisOptions | {[key: string]: any; authenticator?: any; debug?: boolean; deserializer?: Deserializer<any, any>; encoding?: string; gracefulShutdown?: boolean; gracePeriod?: number; headers?: Record<string, string>; ignoreClusterUpdates?: boolean; inboxPrefix?: string; maxPingOut?: number; maxReconnectAttempts?: number; name?: string; nkey?: any; noEcho?: boolean; nonceSigner?: any; noRandomize?: boolean; pass?: string; pedantic?: boolean; pingInterval?: number; preserveBuffers?: boolean; queue?: string; reconnect?: boolean; reconnectDelayHandler?: any; reconnectJitter?: number; reconnectJitterTLS?: number; reconnectTimeWait?: number; serializer?: Serializer<any, any>; servers?: string | string[]; timeout?: number; tls?: any; token?: string; tokenHandler?: any; useOldRequestStyle?: boolean; user?: string; userCreds?: any; userJWT?: string; verbose?: boolean; waitOnFirstConnect?: boolean; yieldTime?: number; } | MqttClientOptions & object | { consumerTag?: string; deserializer?: Deserializer<any, any>; exchange?: string; exchangeArguments?: Record<string, string>; exchangeType?: "topic" | string & object | "headers" | "direct" | "fanout"; headers?: Record<string, string>; isGlobalPrefetchCount?: boolean; maxConnectionAttempts?: number; noAck?: boolean; noAssert?: boolean; persistent?: boolean; prefetchCount?: number; queue?: string; queueOptions?: AmqplibQueueOptions; replyQueue?: string; routingKey?: string; serializer?: Serializer<any, any>; socketOptions?: AmqpConnectionManagerSocketOptions; urls?: string[] | RmqUrl[]; wildcards?: boolean; } | { client?: KafkaConfig; consumer?: ConsumerConfig; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; postfixId?: string; producer?: ProducerConfig; producerOnlyMode?: boolean; run?: Omit<ConsumerRunConfig, "eachBatch" | "eachMessage">; send?: Omit<ProducerRecord, "topic" | "messages">; serializer?: Serializer<any, any>; subscribe?: Omit<ConsumerSubscribeTopics, "topics">; } | { deserializer?: Deserializer<any, any>; host?: string; incompleteMessageTimeout?: number; maxBufferSize?: number; maxSendBufferSize?: number; port?: number; serializer?: Serializer<any, any>; socketClass?: Type<TcpSocket>; tlsOptions?: ConnectionOptions; } | undefined

object & IORedisOptions


MqttClientOptions & object


Type Literal​

{ consumerTag?: string; deserializer?: Deserializer<any, any>; exchange?: string; exchangeArguments?: Record<string, string>; exchangeType?: "topic" | string & object | "headers" | "direct" | "fanout"; headers?: Record<string, string>; isGlobalPrefetchCount?: boolean; maxConnectionAttempts?: number; noAck?: boolean; noAssert?: boolean; persistent?: boolean; prefetchCount?: number; queue?: string; queueOptions?: AmqplibQueueOptions; replyQueue?: string; routingKey?: string; serializer?: Serializer<any, any>; socketOptions?: AmqpConnectionManagerSocketOptions; urls?: string[] | RmqUrl[]; wildcards?: boolean; }

consumerTag?​

string

A name which the server will use to distinguish message deliveries for the consumer; mustn’t be already in use on the channel. It’s usually easier to omit this, in which case the server will create a random name and supply it in the reply.

deserializer?​

Deserializer<any, any>

A deserializer for the message payload.

exchange?​

string

Name for the exchange. Defaults to the queue name when "wildcards" is set to true.

Default

''
exchangeArguments?​

Record<string, string>

Exchange arguments

exchangeType?​

"topic" | string & object | "headers" | "direct" | "fanout"

Type of the exchange. Accepts the AMQP standard types ('direct', 'fanout', 'topic', 'headers') or any custom exchange type name provided as a string literal.

Default

'topic'
headers?​

Record<string, string>

Additional headers to be sent with every message. Applies only to the producer configuration.

isGlobalPrefetchCount?​

boolean

Sets the per-channel behavior for prefetching messages.

maxConnectionAttempts?​

number

Maximum number of connection attempts. Applies only to the consumer configuration. -1 === infinite

Default

-1
noAck?​

boolean

If true, the broker won’t expect an acknowledgement of messages delivered to this consumer; i.e., it will dequeue messages as soon as they’ve been sent down the wire.

Default

false
noAssert?​

boolean

When false, a queue will not be asserted before consuming.

Default

false
persistent?​

boolean

If truthy, the message will survive broker restarts provided it’s in a queue that also survives restarts.

prefetchCount?​

number

A prefetch count for this channel. The count given is the maximum number of messages sent over the channel that can be awaiting acknowledgement; once there are count messages outstanding, the server will not send more messages on this channel until one or more have been acknowledged.

queue?​

string

The name of the queue.

queueOptions?​

AmqplibQueueOptions

Amqplib queue options.

See

https://amqp-node.github.io/amqplib/channel_api.html#channel_assertQueue

replyQueue?​

string

A reply queue for the producer.

Default

'amq.rabbitmq.reply-to'
routingKey?​

string

Additional routing key for the topic exchange.

serializer?​

Serializer<any, any>

A serializer for the message payload.

socketOptions?​

AmqpConnectionManagerSocketOptions

AMQP Connection Manager socket options.

urls?​

string[] | RmqUrl[]

An array of connection URLs to try in order.

wildcards?​

boolean

Set to true only if you want to use Topic Exchange for routing messages to queues. Enabling this will allow you to use wildcards (*, #) as message and event patterns.

See

https://www.rabbitmq.com/tutorials/tutorial-five-python#topic-exchange

Default

false

Type Literal​

{ client?: KafkaConfig; consumer?: ConsumerConfig; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; postfixId?: string; producer?: ProducerConfig; producerOnlyMode?: boolean; run?: Omit<ConsumerRunConfig, "eachBatch" | "eachMessage">; send?: Omit<ProducerRecord, "topic" | "messages">; serializer?: Serializer<any, any>; subscribe?: Omit<ConsumerSubscribeTopics, "topics">; }

client?​

KafkaConfig

consumer?​

ConsumerConfig

deserializer?​

Deserializer<any, any>

parser?​

KafkaParserConfig

postfixId?​

string

Defaults to "-server" on server side and "-client" on client side.

producer?​

ProducerConfig

producerOnlyMode?​

boolean

run?​

Omit<ConsumerRunConfig, "eachBatch" | "eachMessage">

Options passed to KafkaJS consumer.run(). Note: partitionsConsumedConcurrently (KafkaJS parameter) controls concurrent processing at the partition level (not topic level).

send?​

Omit<ProducerRecord, "topic" | "messages">

serializer?​

Serializer<any, any>

subscribe?​

Omit<ConsumerSubscribeTopics, "topics">


Type Literal​

{ deserializer?: Deserializer<any, any>; host?: string; incompleteMessageTimeout?: number; maxBufferSize?: number; maxSendBufferSize?: number; port?: number; serializer?: Serializer<any, any>; socketClass?: Type<TcpSocket>; tlsOptions?: ConnectionOptions; }

deserializer?​

Deserializer<any, any>

host?​

string

incompleteMessageTimeout?​

number

How long a peer may stay silent in the middle of a packet before the connection is dropped, in milliseconds (default: 30000). The timer is refreshed on every read, so a slow but progressing transfer is never interrupted; it only fires when a peer stops sending mid-packet, which would otherwise pin the partial packet in memory indefinitely. Set to 0 to disable.

maxBufferSize?​

number

Maximum buffer size in characters (default: 128MB in characters, i.e., (512 * 1024 * 1024) / 4). This limit prevents memory exhaustion when receiving large TCP messages.

maxSendBufferSize?​

number

Maximum number of bytes that may sit queued for a peer that is not reading them, in bytes (default: 128MB). Reading from the peer is suspended while the outgoing buffer is backed up, and the connection is dropped once this limit is passed. Set to 0 to disable.

port?​

number

serializer?​

Serializer<any, any>

socketClass?​

Type<TcpSocket>

tlsOptions?​

ConnectionOptions


undefined

Returns​

void

Inherited from​

Server.initializeDeserializer


initializeSerializer()​

protected initializeSerializer(options): void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:106

Parameters​

options​

{ channelOptions?: ChannelOptions; credentials?: any; gracefulShutdown?: boolean; keepalive?: { http2MaxPingStrikes?: number; http2MaxPingsWithoutData?: number; http2MinPingIntervalWithoutDataMs?: number; http2MinTimeBetweenPingsMs?: number; keepalivePermitWithoutCalls?: number; keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; }; loader?: { alternateCommentMode?: boolean; arrays?: boolean; bytes?: Function; defaults?: boolean; enums?: Function; includeDirs?: string[]; json?: boolean; keepCase?: boolean; longs?: Function; objects?: boolean; oneofs?: boolean; }; maxMetadataSize?: number; maxReceiveMessageLength?: number; maxSendMessageLength?: number; onLoadPackageDefinition?: (pkg, server) => void; package: string | string[]; packageDefinition?: any; protoLoader?: string; protoPath?: string | string[]; url?: string; } | object & IORedisOptions | {[key: string]: any; authenticator?: any; debug?: boolean; deserializer?: Deserializer<any, any>; encoding?: string; gracefulShutdown?: boolean; gracePeriod?: number; headers?: Record<string, string>; ignoreClusterUpdates?: boolean; inboxPrefix?: string; maxPingOut?: number; maxReconnectAttempts?: number; name?: string; nkey?: any; noEcho?: boolean; nonceSigner?: any; noRandomize?: boolean; pass?: string; pedantic?: boolean; pingInterval?: number; preserveBuffers?: boolean; queue?: string; reconnect?: boolean; reconnectDelayHandler?: any; reconnectJitter?: number; reconnectJitterTLS?: number; reconnectTimeWait?: number; serializer?: Serializer<any, any>; servers?: string | string[]; timeout?: number; tls?: any; token?: string; tokenHandler?: any; useOldRequestStyle?: boolean; user?: string; userCreds?: any; userJWT?: string; verbose?: boolean; waitOnFirstConnect?: boolean; yieldTime?: number; } | MqttClientOptions & object | { consumerTag?: string; deserializer?: Deserializer<any, any>; exchange?: string; exchangeArguments?: Record<string, string>; exchangeType?: "topic" | string & object | "headers" | "direct" | "fanout"; headers?: Record<string, string>; isGlobalPrefetchCount?: boolean; maxConnectionAttempts?: number; noAck?: boolean; noAssert?: boolean; persistent?: boolean; prefetchCount?: number; queue?: string; queueOptions?: AmqplibQueueOptions; replyQueue?: string; routingKey?: string; serializer?: Serializer<any, any>; socketOptions?: AmqpConnectionManagerSocketOptions; urls?: string[] | RmqUrl[]; wildcards?: boolean; } | { client?: KafkaConfig; consumer?: ConsumerConfig; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; postfixId?: string; producer?: ProducerConfig; producerOnlyMode?: boolean; run?: Omit<ConsumerRunConfig, "eachBatch" | "eachMessage">; send?: Omit<ProducerRecord, "topic" | "messages">; serializer?: Serializer<any, any>; subscribe?: Omit<ConsumerSubscribeTopics, "topics">; } | { deserializer?: Deserializer<any, any>; host?: string; incompleteMessageTimeout?: number; maxBufferSize?: number; maxSendBufferSize?: number; port?: number; serializer?: Serializer<any, any>; socketClass?: Type<TcpSocket>; tlsOptions?: ConnectionOptions; } | undefined

object & IORedisOptions


MqttClientOptions & object


Type Literal​

{ consumerTag?: string; deserializer?: Deserializer<any, any>; exchange?: string; exchangeArguments?: Record<string, string>; exchangeType?: "topic" | string & object | "headers" | "direct" | "fanout"; headers?: Record<string, string>; isGlobalPrefetchCount?: boolean; maxConnectionAttempts?: number; noAck?: boolean; noAssert?: boolean; persistent?: boolean; prefetchCount?: number; queue?: string; queueOptions?: AmqplibQueueOptions; replyQueue?: string; routingKey?: string; serializer?: Serializer<any, any>; socketOptions?: AmqpConnectionManagerSocketOptions; urls?: string[] | RmqUrl[]; wildcards?: boolean; }

consumerTag?​

string

A name which the server will use to distinguish message deliveries for the consumer; mustn’t be already in use on the channel. It’s usually easier to omit this, in which case the server will create a random name and supply it in the reply.

deserializer?​

Deserializer<any, any>

A deserializer for the message payload.

exchange?​

string

Name for the exchange. Defaults to the queue name when "wildcards" is set to true.

Default

''
exchangeArguments?​

Record<string, string>

Exchange arguments

exchangeType?​

"topic" | string & object | "headers" | "direct" | "fanout"

Type of the exchange. Accepts the AMQP standard types ('direct', 'fanout', 'topic', 'headers') or any custom exchange type name provided as a string literal.

Default

'topic'
headers?​

Record<string, string>

Additional headers to be sent with every message. Applies only to the producer configuration.

isGlobalPrefetchCount?​

boolean

Sets the per-channel behavior for prefetching messages.

maxConnectionAttempts?​

number

Maximum number of connection attempts. Applies only to the consumer configuration. -1 === infinite

Default

-1
noAck?​

boolean

If true, the broker won’t expect an acknowledgement of messages delivered to this consumer; i.e., it will dequeue messages as soon as they’ve been sent down the wire.

Default

false
noAssert?​

boolean

When false, a queue will not be asserted before consuming.

Default

false
persistent?​

boolean

If truthy, the message will survive broker restarts provided it’s in a queue that also survives restarts.

prefetchCount?​

number

A prefetch count for this channel. The count given is the maximum number of messages sent over the channel that can be awaiting acknowledgement; once there are count messages outstanding, the server will not send more messages on this channel until one or more have been acknowledged.

queue?​

string

The name of the queue.

queueOptions?​

AmqplibQueueOptions

Amqplib queue options.

See

https://amqp-node.github.io/amqplib/channel_api.html#channel_assertQueue

replyQueue?​

string

A reply queue for the producer.

Default

'amq.rabbitmq.reply-to'
routingKey?​

string

Additional routing key for the topic exchange.

serializer?​

Serializer<any, any>

A serializer for the message payload.

socketOptions?​

AmqpConnectionManagerSocketOptions

AMQP Connection Manager socket options.

urls?​

string[] | RmqUrl[]

An array of connection URLs to try in order.

wildcards?​

boolean

Set to true only if you want to use Topic Exchange for routing messages to queues. Enabling this will allow you to use wildcards (*, #) as message and event patterns.

See

https://www.rabbitmq.com/tutorials/tutorial-five-python#topic-exchange

Default

false

Type Literal​

{ client?: KafkaConfig; consumer?: ConsumerConfig; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; postfixId?: string; producer?: ProducerConfig; producerOnlyMode?: boolean; run?: Omit<ConsumerRunConfig, "eachBatch" | "eachMessage">; send?: Omit<ProducerRecord, "topic" | "messages">; serializer?: Serializer<any, any>; subscribe?: Omit<ConsumerSubscribeTopics, "topics">; }

client?​

KafkaConfig

consumer?​

ConsumerConfig

deserializer?​

Deserializer<any, any>

parser?​

KafkaParserConfig

postfixId?​

string

Defaults to "-server" on server side and "-client" on client side.

producer?​

ProducerConfig

producerOnlyMode?​

boolean

run?​

Omit<ConsumerRunConfig, "eachBatch" | "eachMessage">

Options passed to KafkaJS consumer.run(). Note: partitionsConsumedConcurrently (KafkaJS parameter) controls concurrent processing at the partition level (not topic level).

send?​

Omit<ProducerRecord, "topic" | "messages">

serializer?​

Serializer<any, any>

subscribe?​

Omit<ConsumerSubscribeTopics, "topics">


Type Literal​

{ deserializer?: Deserializer<any, any>; host?: string; incompleteMessageTimeout?: number; maxBufferSize?: number; maxSendBufferSize?: number; port?: number; serializer?: Serializer<any, any>; socketClass?: Type<TcpSocket>; tlsOptions?: ConnectionOptions; }

deserializer?​

Deserializer<any, any>

host?​

string

incompleteMessageTimeout?​

number

How long a peer may stay silent in the middle of a packet before the connection is dropped, in milliseconds (default: 30000). The timer is refreshed on every read, so a slow but progressing transfer is never interrupted; it only fires when a peer stops sending mid-packet, which would otherwise pin the partial packet in memory indefinitely. Set to 0 to disable.

maxBufferSize?​

number

Maximum buffer size in characters (default: 128MB in characters, i.e., (512 * 1024 * 1024) / 4). This limit prevents memory exhaustion when receiving large TCP messages.

maxSendBufferSize?​

number

Maximum number of bytes that may sit queued for a peer that is not reading them, in bytes (default: 128MB). Reading from the peer is suspended while the outgoing buffer is backed up, and the connection is dropped once this limit is passed. Set to 0 to disable.

port?​

number

serializer?​

Serializer<any, any>

socketClass?​

Type<TcpSocket>

tlsOptions?​

ConnectionOptions


undefined

Returns​

void

Inherited from​

Server.initializeSerializer


listen()​

listen(callback): void

Defined in: packages/messaging/src/nest.ts:47

Binds Nest's handlers and starts serving.

Parameters​

callback​

() => void

Nest's "ready" callback.

Returns​

void

Implementation of​

CustomTransportStrategy.listen

Overrides​

Server.listen


loadPackage()​

protected loadPackage<T>(name, ctx, loader?): T | Promise<T>

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:104

Type Parameters​

T​

T = any

Parameters​

name​

string

ctx​

string

loader?​

() => T

Returns​

T | Promise<T>

Inherited from​

Server.loadPackage


loadPackageSynchronously()​

protected loadPackageSynchronously<T>(name, ctx, loader?): T

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:105

Type Parameters​

T​

T = any

Parameters​

name​

string

ctx​

string

loader?​

() => T

Returns​

T

Inherited from​

Server.loadPackageSynchronously


normalizePattern()​

protected normalizePattern(pattern): string

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:115

Parameters​

pattern​

MsPattern

Returns​

string

Inherited from​

Server.normalizePattern


on()​

on(): this

Defined in: packages/messaging/src/nest.ts:73

Not used: this transport has no event emitter.

Returns​

this

Overrides​

Server.on


runWithProcessingHooks()​

protected runWithProcessingHooks(context, fn, endHookContext?): void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:89

Runs fn between the processing start and end hooks.

fn receives a runner that closes the span exactly once and attaches it to the teardown of whatever stream it produces. If fn rejects before that teardown can run, the span is closed here and the rejection travels on to the transport's client library.

endHookContext is for transports that report a different context to the end hook than to the start hook (gRPC passes the request).

Parameters​

context​

BaseRpcContext

fn​

(runEndHook) => Promise<void>

endHookContext?​

BaseRpcContext<unknown[]>

Returns​

void

Inherited from​

Server.runWithProcessingHooks


send()​

send(stream$, respond): Subscription

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:70

Parameters​

stream$​

Observable<any>

respond​

(data) => void | Promise<unknown>

Returns​

Subscription

Inherited from​

Server.send


setOnProcessingEndHook()​

setOnProcessingEndHook(hook): void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:66

Sets a hook that will be called when processing ends.

Parameters​

hook​

(transportId, context) => void

Returns​

void

Inherited from​

Server.setOnProcessingEndHook


setOnProcessingStartHook()​

setOnProcessingStartHook(hook): void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:62

Sets a hook that will be called when processing starts.

Parameters​

hook​

(transportId, context, done) => void

Returns​

void

Inherited from​

Server.setOnProcessingStartHook


setTransportId()​

setTransportId(transportId): void

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:58

Sets the transport identifier.

Parameters​

transportId​

symbol | Transport

Unique transport identifier.

Returns​

void

Inherited from​

Server.setTransportId


transformToObservable()​

Call Signature​

transformToObservable<T>(resultOrDeferred): Observable<T>

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:99

Type Parameters​
T​

T

Parameters​
resultOrDeferred​

Observable<T> | Promise<T>

Returns​

Observable<T>

Inherited from​

Server.transformToObservable

Call Signature​

transformToObservable<T>(resultOrDeferred): Observable<T>

Defined in: node_modules/.pnpm/@nestjs+microservices@12.1.2_@grpc+grpc-js@1.14.6_@nats-io+transport-node@3.4.0_@nestjs_05e89117f9531a3873203f290636d11d/node_modules/@nestjs/microservices/server/server.d.ts:100

Type Parameters​
T​

T

Parameters​
resultOrDeferred​

T

Returns​

Observable<T>

Inherited from​

Server.transformToObservable


unwrap()​

unwrap<T>(): T

Defined in: packages/messaging/src/nest.ts:78

Type Parameters​

T​

T

Returns​

T

The broker wire.

Overrides​

Server.unwrap