Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@node-ts/bus-core

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@node-ts/bus-core - npm Package Compare versions

Comparing version 0.1.12 to 0.1.13

src/handler/README.md

40

dist/transport/transport.d.ts
import { Event, Command } from '@node-ts/bus-messages';
import { TransportMessage } from './transport-message';
import { HandlerRegistry } from '../handler';
/**
* A transport adapter interface that enables the service bus to use a messaging technology.
*/
export interface Transport<TransportMessageType = {}> {
/**
* Publishes an event to the underlying transport. This is generally done to a topic or some other
* mechanism that consumers can subscribe themselves to
* @param event A domain event to be published
*/
publish<TEvent extends Event>(event: TEvent): Promise<void>;
/**
* Sends a command to the underlying transport. This is generally done to a topic or some other
* mechanism that consumers can subscribe themselves to
* @param command A domain command to be sent
*/
send<TCommand extends Command>(command: TCommand): Promise<void>;
/**
* Fetch the next message from the underlying queue. If there are no messages, then `undefined`
* should be returned.
*
* @returns The message construct from the underlying transport, that inclues both the raw message envelope
* plus the contents or body that contains the `@node-ts/bus-messages` message.
*/
readNextMessage(): Promise<TransportMessage<TransportMessageType> | undefined>;
/**
* Removes a message from the underlying transport. This will be called once a message has been
* successfully handled by any of the message handling functions.
* @param message The message to be removed from the transport
*/
deleteMessage(message: TransportMessage<TransportMessageType>): Promise<void>;
/**
* Returns a message to the queue for retry. This will be called if an error was thrown when
* trying to process a message.
* @param message The message to be returned to the queue for reprocessing
*/
returnMessage(message: TransportMessage<TransportMessageType>): Promise<void>;
/**
* An optional function that will be called when the service bus is starting. This is an
* opportunity for the transport to see what messages need to be handled so that subscriptions
* to the topics can be created.
* @param handlerRegistry The list of messages being handled by the bus that the transport needs to subscribe to.
*/
initialize?(handlerRegistry: HandlerRegistry): Promise<void>;
/**
* An optional function that will be called when the service bus is shutting down. This is an
* opportunity for the transport to close out any open requests to fetch messages etc.
*/
dispose?(): Promise<void>;
}

4

package.json
{
"name": "@node-ts/bus-core",
"version": "0.1.12",
"version": "0.1.13",
"description": "A message bus abstraction to build simple distributed applications in Node.",

@@ -47,3 +47,3 @@ "main": "./dist/index.js",

],
"gitHead": "465c48eaf15495aa61b9bdb6bc2aac48f39629e9"
"gitHead": "d32f3f632ea0f242333bc518325812dbad4e9aff"
}

@@ -5,10 +5,56 @@ import { Event, Command } from '@node-ts/bus-messages'

/**
* A transport adapter interface that enables the service bus to use a messaging technology.
*/
export interface Transport<TransportMessageType = {}> {
/**
* Publishes an event to the underlying transport. This is generally done to a topic or some other
* mechanism that consumers can subscribe themselves to
* @param event A domain event to be published
*/
publish<TEvent extends Event> (event: TEvent): Promise<void>
/**
* Sends a command to the underlying transport. This is generally done to a topic or some other
* mechanism that consumers can subscribe themselves to
* @param command A domain command to be sent
*/
send<TCommand extends Command> (command: TCommand): Promise<void>
/**
* Fetch the next message from the underlying queue. If there are no messages, then `undefined`
* should be returned.
*
* @returns The message construct from the underlying transport, that inclues both the raw message envelope
* plus the contents or body that contains the `@node-ts/bus-messages` message.
*/
readNextMessage (): Promise<TransportMessage<TransportMessageType> | undefined>
/**
* Removes a message from the underlying transport. This will be called once a message has been
* successfully handled by any of the message handling functions.
* @param message The message to be removed from the transport
*/
deleteMessage (message: TransportMessage<TransportMessageType>): Promise<void>
/**
* Returns a message to the queue for retry. This will be called if an error was thrown when
* trying to process a message.
* @param message The message to be returned to the queue for reprocessing
*/
returnMessage (message: TransportMessage<TransportMessageType>): Promise<void>
/**
* An optional function that will be called when the service bus is starting. This is an
* opportunity for the transport to see what messages need to be handled so that subscriptions
* to the topics can be created.
* @param handlerRegistry The list of messages being handled by the bus that the transport needs to subscribe to.
*/
initialize? (handlerRegistry: HandlerRegistry): Promise<void>
/**
* An optional function that will be called when the service bus is shutting down. This is an
* opportunity for the transport to close out any open requests to fetch messages etc.
*/
dispose? (): Promise<void>
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc