@node-ts/bus-core
Advanced tools
Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "@node-ts/bus-core", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A service bus for message-based, distributed node applications", | ||
@@ -50,3 +50,3 @@ "main": "./dist/index.js", | ||
], | ||
"gitHead": "5894011a1c2150aa25735267c9ef78dcaeb0cd70" | ||
"gitHead": "18b72030c51a4929214537554ff0707a640af5b3" | ||
} |
@@ -17,2 +17,3 @@ # Handlers | ||
import { ACCOUNT_SYMBOLS, EmailService } from 'domain' | ||
import { LOGGER_SYMBOLS, Logger } from '@node-ts/logger-core' | ||
@@ -62,2 +63,18 @@ @HandlesMessage(SendWelcomeEmail) | ||
## Receiving message options, attributes and metadata | ||
Additional metadata can be sent along with messages that don't belong to the message body, but is instead added to the message headers or attributes as metadata. This is sent to messages handlers as a second, optional parameter. For example: | ||
```typescript | ||
class Handler { | ||
async handle ( | ||
_: Command, | ||
messageOptions: MessageOptions<{ userId: string }> | ||
): Promise<void> { | ||
this.logger.info('Example consuming message headers', { userId: messageOptions.attributes.userId }) | ||
} | ||
} | ||
``` | ||
## Messages that fail processing | ||
@@ -64,0 +81,0 @@ |
117593