Skip to content

packages/microservices/src

Classes

ClassDescription
BaseServerAbstract base class for all built-in transport servers.
ClientFactoryFactory that creates the correct ClientProxy implementation for the given transport configuration.
ClientProxyAbstract base class for all microservice client proxies.
ElysiaNestApplicationTop-level application class that ties together an Elysia HTTP server and one or more microservice transport servers.
RabbitMQClientClient proxy that communicates over RabbitMQ (AMQP via amqplib).
RabbitMQServerTransport server that uses RabbitMQ (AMQP via amqplib).
RedisClientClient proxy that communicates over Redis Pub/Sub.
RedisServerTransport server that uses Redis Pub/Sub for message passing.
ServerFactoryFactory that instantiates the correct transport server based on the provided MicroserviceOptions.
TcpClientClient proxy that communicates over raw TCP with newline-delimited JSON framing.
TcpServerTransport server that uses raw TCP sockets with newline-delimited JSON framing for request-response and fire-and-forget communication.

Functions

FunctionDescription
CatchMarks an exception filter class and declares which exception types it handles. Omitting arguments causes the filter to catch all exceptions.
ClientMarks a class property for automatic ClientProxy injection. The injected client is created using config and is ready to use after the application starts.
createElysiaNestApplicationCreates a bare ElysiaNestApplication that wraps an already-configured Elysia instance.
createElysiaNestApplicationWithControllersCreates a new ElysiaNestApplication with a set of controllers pre-registered for pattern handler scanning.
EventPatternMarks a controller method as a fire-and-forget event handler. The method is called when a publisher emits an event matching pattern. No response is sent back to the publisher.
MessageCtxInjects the microservice execution context into a method parameter. The context contains transport information and the matched pattern.
MessagePatternMarks a controller method as a request-response message handler. The method is called when a client sends a message matching pattern and it is expected to return a response.
PayloadExtracts the message payload (or a nested property of it) and injects it as a method parameter.

Interfaces

InterfaceDescription
CustomTransportStrategyInterface that custom transport strategies must implement. Pass an object conforming to this interface to connectMicroservice to use a transport not provided by this package.
EventPatternMetadataShape of metadata stored by the EventPattern decorator.
IncomingEventAn incoming event packet (fire-and-forget pattern).
IncomingRequestAn incoming request packet (request-response pattern).
MessagePatternMetadataShape of metadata stored by the MessagePattern decorator.
MicroserviceConfigurationBase configuration shared by all built-in transport strategies.
MicroserviceContextContextual information injected via the MessageCtx decorator.
MicroserviceExceptionContextContextual information passed to exception filters when an error occurs inside a microservice message or event handler.
MicroserviceServerInfoMetadata stored per connected microservice.
OutgoingRequestAn outgoing request packet sent by a ClientProxy.
OutgoingResponseAn outgoing response packet (request-response pattern).
PatternHandlerMetadata describing a registered pattern handler.
RabbitMQOptionsConnection options for the RabbitMQ (amqplib) transport.
RedisOptionsConnection options for the Redis (ioredis) transport.
ServerContract that every built-in transport server must satisfy. Custom transports only need to implement CustomTransportStrategy.
ServerFactoryInterfaceFactory interface for creating transport servers.
TcpOptionsConnection options for the TCP transport.

Type Aliases

Type AliasDescription
MessageHandlerFunction signature for pattern handlers registered on a Server.
MicroserviceModuleMetadataSubset of module options relevant to microservice modules.
MicroserviceOptionsUnion type accepted by connectMicroservice.

Enumerations

EnumerationDescription
TransportAvailable transport strategies for microservice connections.

Variables

VariableDescription
CATCH_EXCEPTIONS_METADATAMetadata key for the Catch decorator. Must match the key used in src/exceptions/catch.decorator.ts.
CLIENT_PROXY_METADATAMetadata key for the Client property decorator.
EVENT_PATTERN_METADATAMetadata key for the EventPattern decorator.
MESSAGE_DATA_METADATAMetadata key for the Payload parameter decorator.
MESSAGE_PATTERN_CTX_METADATAMetadata key for the MessageCtx parameter decorator.
MESSAGE_PATTERN_METADATAMetadata key for the MessagePattern decorator.
MICROSERVICE_METADATAMetadata key used to register a class as a microservice module.

References

ExceptionContext

Re-exports ExceptionContext


ExceptionFilter

Re-exports ExceptionFilter

Released under the MIT License.