@node-ts/bus-messages
Advanced tools
Comparing version 0.1.6 to 0.1.9
@@ -36,3 +36,8 @@ declare type Uuid = string; | ||
stickyAttributes: StickyAttributeType; | ||
constructor(properties?: { | ||
correlationId?: Uuid; | ||
attributes?: AttributeType; | ||
stickyAttributes?: StickyAttributeType; | ||
}); | ||
} | ||
export {}; |
@@ -8,23 +8,9 @@ "use strict"; | ||
class MessageAttributes { | ||
constructor() { | ||
/** | ||
* Additional metadata that will be sent alongside the message payload. | ||
* This is useful for sending information like: | ||
* - the id of a user where the message originated from | ||
* - the originating system hostname or IP for auditing information | ||
* - when the message was first sent | ||
* | ||
* These attributes will be attached to the outgoing message, but will not | ||
* propagate beyond the first receipt | ||
*/ | ||
this.attributes = {}; | ||
/** | ||
* Additional metadata that will be sent alongside the message payload. | ||
* This is useful for sending information like: | ||
* - The id of the user who originally sent the message that triggered this message | ||
* | ||
* These values are sticky, in that they will propagate for any message that | ||
* is sent as a result of receiving the message with sticky attributes. | ||
*/ | ||
this.stickyAttributes = {}; | ||
constructor(properties) { | ||
if (!!properties) { | ||
const { correlationId, attributes, stickyAttributes } = properties; | ||
this.correlationId = correlationId; | ||
this.attributes = attributes || {}; | ||
this.stickyAttributes = stickyAttributes || {}; | ||
} | ||
} | ||
@@ -31,0 +17,0 @@ } |
{ | ||
"name": "@node-ts/bus-messages", | ||
"description": "A core set of message definitions for distributed applications.", | ||
"version": "0.1.6", | ||
"version": "0.1.9", | ||
"license": "MIT", | ||
@@ -37,3 +37,3 @@ "main": "./dist/index.js", | ||
], | ||
"gitHead": "b449e754469f945ab462e284a72160389414dec2" | ||
"gitHead": "fc984b77eedbd3e0d48f52d888c6ad5795faa145" | ||
} |
@@ -32,3 +32,3 @@ type Uuid = string | ||
*/ | ||
attributes: AttributeType = {} as AttributeType | ||
attributes: AttributeType | ||
@@ -43,3 +43,17 @@ /** | ||
*/ | ||
stickyAttributes: StickyAttributeType = {} as StickyAttributeType | ||
stickyAttributes: StickyAttributeType | ||
constructor (properties?: { | ||
correlationId?: Uuid, | ||
attributes?: AttributeType, | ||
stickyAttributes?: StickyAttributeType | ||
}) { | ||
if (!!properties) { | ||
const { correlationId, attributes, stickyAttributes } = properties | ||
this.correlationId = correlationId | ||
this.attributes = attributes || {} as AttributeType | ||
this.stickyAttributes = stickyAttributes || {} as StickyAttributeType | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
182
14755