Common

Common

new Common(amqpUri, channelName, configurationopt)

Source:
Parameters:
Name Type Attributes Description
amqpUri AmqpURI
channelName ChannelName
configuration Configuration <optional>

Members

(protected) _configuration :Object

Source:
Type:
  • Object

(protected) _consoleLogger :ConsoleLogger

Internal instance to log messages.

Source:
Type:

(protected) _E :*|EventEmitter

Used to emit messages and statues.

Source:
Type:
  • * | EventEmitter

(protected) _isReady :boolean

Internal flag for signaling of the connection if ready.

Source:
Type:
  • boolean

(protected) _name :string

Name associated with this instance - displayed in the logs. Each instance should override this with some relevant name.

Source:
Type:
  • string

Methods

_commonPublishPreparations(contentToPublish) → {*|null}

Source:
Parameters:
Name Type Description
contentToPublish number | string | boolean | Object | Array
Returns:
Type:
* | null

(protected) _emitAndDispatchError(errorMessage)

Source:
Parameters:
Name Type Description
errorMessage string

(protected) _logData(data, description)

Log the data that was received or send in the channels.

Source:
Parameters:
Name Type Description
data Object | Buffer
description string

some additional information to be logged with the data

(protected) _messageDispatcherWrapper(logType, message)

Wrapper for common message handling.

Source:
Parameters:
Name Type Description
logType 'log' | 'info' | 'warn' | 'error'

one of log, info, warn, error

message string

message to print

(protected) _parseConsumedMessage(message) → {number|string|Object|boolean|Array|null}

Parse the message that was consumed. The parsing tries parsing via the JSON.parse. If this fails, it just tries to return a string representation. It can parse:

  • number
  • string
  • plain Object
  • Array
  • boolean
Source:
Parameters:
Name Type Description
message Object

as received by the consumer; it expects a property content of type Buffer

Returns:
Type:
number | string | Object | boolean | Array | null

null is returned if the message was not parsed

(protected) _preparePublishingMessage(message) → {Buffer|null}

Prepare the data to be published.

Source:
Parameters:
Name Type Description
message string | Object | number | boolean | Array
Returns:
Type:
Buffer | null

closeConnection() → {boolean}

Close the connection. The client will not preform an automatic reconnect when this is called.

Source:
Returns:
Type:
boolean

false if there was an error

getEventer() → {EventEmitter}

Get the EventEmitter that emits messages and errors.

Source:
Returns:
Type:
EventEmitter

isReady() → {boolean}

Check if the connection is operational.

Source:
Returns:
Type:
boolean

openConnection()

Open the connection.

Source:

toString() → {string}

Get a string representation of this instance. If prints the keys and values of all non-private members that are primitives.

Source:
Returns:
Type:
string