packages/microservices/src
Classes
| Class | Description |
|---|---|
| BaseServer | Abstract base class for all built-in transport servers. |
| ClientFactory | Factory that creates the correct ClientProxy implementation for the given transport configuration. |
| ClientProxy | Abstract base class for all microservice client proxies. |
| ElysiaNestApplication | Top-level application class that ties together an Elysia HTTP server and one or more microservice transport servers. |
| RabbitMQClient | Client proxy that communicates over RabbitMQ (AMQP via amqplib). |
| RabbitMQServer | Transport server that uses RabbitMQ (AMQP via amqplib). |
| RedisClient | Client proxy that communicates over Redis Pub/Sub. |
| RedisServer | Transport server that uses Redis Pub/Sub for message passing. |
| ServerFactory | Factory that instantiates the correct transport server based on the provided MicroserviceOptions. |
| TcpClient | Client proxy that communicates over raw TCP with newline-delimited JSON framing. |
| TcpServer | Transport server that uses raw TCP sockets with newline-delimited JSON framing for request-response and fire-and-forget communication. |
Functions
| Function | Description |
|---|---|
| Catch | Marks an exception filter class and declares which exception types it handles. Omitting arguments causes the filter to catch all exceptions. |
| Client | Marks a class property for automatic ClientProxy injection. The injected client is created using config and is ready to use after the application starts. |
| createElysiaNestApplication | Creates a bare ElysiaNestApplication that wraps an already-configured Elysia instance. |
| createElysiaNestApplicationWithControllers | Creates a new ElysiaNestApplication with a set of controllers pre-registered for pattern handler scanning. |
| EventPattern | Marks 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. |
| MessageCtx | Injects the microservice execution context into a method parameter. The context contains transport information and the matched pattern. |
| MessagePattern | Marks 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. |
| Payload | Extracts the message payload (or a nested property of it) and injects it as a method parameter. |
Interfaces
| Interface | Description |
|---|---|
| CustomTransportStrategy | Interface that custom transport strategies must implement. Pass an object conforming to this interface to connectMicroservice to use a transport not provided by this package. |
| EventPatternMetadata | Shape of metadata stored by the EventPattern decorator. |
| IncomingEvent | An incoming event packet (fire-and-forget pattern). |
| IncomingRequest | An incoming request packet (request-response pattern). |
| MessagePatternMetadata | Shape of metadata stored by the MessagePattern decorator. |
| MicroserviceConfiguration | Base configuration shared by all built-in transport strategies. |
| MicroserviceContext | Contextual information injected via the MessageCtx decorator. |
| MicroserviceExceptionContext | Contextual information passed to exception filters when an error occurs inside a microservice message or event handler. |
| MicroserviceServerInfo | Metadata stored per connected microservice. |
| OutgoingRequest | An outgoing request packet sent by a ClientProxy. |
| OutgoingResponse | An outgoing response packet (request-response pattern). |
| PatternHandler | Metadata describing a registered pattern handler. |
| RabbitMQOptions | Connection options for the RabbitMQ (amqplib) transport. |
| RedisOptions | Connection options for the Redis (ioredis) transport. |
| Server | Contract that every built-in transport server must satisfy. Custom transports only need to implement CustomTransportStrategy. |
| ServerFactoryInterface | Factory interface for creating transport servers. |
| TcpOptions | Connection options for the TCP transport. |
Type Aliases
| Type Alias | Description |
|---|---|
| MessageHandler | Function signature for pattern handlers registered on a Server. |
| MicroserviceModuleMetadata | Subset of module options relevant to microservice modules. |
| MicroserviceOptions | Union type accepted by connectMicroservice. |
Enumerations
| Enumeration | Description |
|---|---|
| Transport | Available transport strategies for microservice connections. |
Variables
| Variable | Description |
|---|---|
| CATCH_EXCEPTIONS_METADATA | Metadata key for the Catch decorator. Must match the key used in src/exceptions/catch.decorator.ts. |
| CLIENT_PROXY_METADATA | Metadata key for the Client property decorator. |
| EVENT_PATTERN_METADATA | Metadata key for the EventPattern decorator. |
| MESSAGE_DATA_METADATA | Metadata key for the Payload parameter decorator. |
| MESSAGE_PATTERN_CTX_METADATA | Metadata key for the MessageCtx parameter decorator. |
| MESSAGE_PATTERN_METADATA | Metadata key for the MessagePattern decorator. |
| MICROSERVICE_METADATA | Metadata key used to register a class as a microservice module. |
References
ExceptionContext
Re-exports ExceptionContext
ExceptionFilter
Re-exports ExceptionFilter