Events
Creating an Event
import { Event } from '@node-ts/bus-messages'
export class CreditCardCharged extends Event {
/**
* A unique name that identifies the message. This should be done in namespace style syntax,
* ie: organisation/domain/event-name
*/
$name = 'my-app/accounts/credit-card-charged'
/**
* The contract version of this message. This can be incremented if this message changes the
* number of properties etc to maintain backwards compatibility
*/
$version = 1
/**
* A credit card was successfully charged
* @param creditCardToken Identifies the card that was charged
* @param amount The amount, in USD, that the card was charged for
*/
constructor (
readonly creditCardToken: string,
readonly amount: number
) {
}
}Publishing an Event
Handling an Event
Last updated