Module: index

The Index file for project. Returns the publish and subscribe methods. These define the API for a transport layer. In this case, the transport uses Kafka.
Source:

Methods

(inner) Publish(message) → {Promise}

Parameters:
Name Type Description
message object { eventName, buffer, config }
Properties
Name Type Description
eventName string the name of the event to publish
buffer buffer the message to send as a buffer
config object config object
Properties:
Name Type Description
emitter EventEmitter
Properties
Name Type Description
ERROR string the error event name
Source:
Returns:
Type
Promise
Example
let buffer = ...,
	config = {
	}
index.publish({ eventName: 'test', buffer, config });

(inner) Subscribe(subscriberConfig) → {Promise}

Parameters:
Name Type Description
subscriberConfig object { eventName, handler, config }
Properties
Name Type Description
eventName string the name of the event to listen for
handler function handler function called when the event is heard
config object config object
Properties:
Name Type Description
emitter EventEmitter
Properties
Name Type Description
ERROR string the error event name
Source:
Returns:
Type
Promise
Example
let handler = (buffer) => 
	{
		console.log(buffer);
	},
	config = {
	}
index.subscribe({ eventName: 'test', handler, config });