Skip to content

itavy/mq-structure

Repository files navigation

mq-Structure

Instalation

npm install @itavy/mq-structure

API

Classes

MQMessage

MQMessage factory class

MQSerializer

MQSerializer class

Objects

itavy/mq-structure : object

MQMessage

MQMessage factory class

Kind: global class

MQMessage.fromSync(request, [version]) ⇒ MQMessageV1

create mq message from a buffer or from an object

Kind: static method of MQMessage
Returns: MQMessageV1 - mq message
Access: public

Param Type Default Description
request Buffer | Object request to be decoded
[version] Object MQMessageV1 class instance for building request

MQMessage.from(request, [version]) ⇒ Promise.<MQMessageV1>

create mq message from a buffer or from an object

Kind: static method of MQMessage
Returns: Promise.<MQMessageV1> - resolves with decoded message
Access: public

Param Type Default Description
request Buffer | Object request to be decoded
[version] String 1 version for creating mq message

MQMessage.setPBSerializer([sourceIdentifier]) ⇒ undefined

set Protobuf singleton serializer

Kind: static method of MQMessage
Access: public

Param Type Default Description
[sourceIdentifier] String 'itavy.mq-structure' sourceIdentifier

MQSerializer

MQSerializer class

Kind: global class

new MQSerializer(serializationSchema)

Param Type Description
serializationSchema Object serializationSchema

mqSerializer.serialize(request, [version]) ⇒ Promise.<Buffer>

Serialize a structure request

Kind: instance method of MQSerializer
Returns: Promise.<Buffer> - resolves with serialized message
Access: public

Param Type Default Description
request Object message to be serialized
[version] String '1' default version for serializing message

mqSerializer.serializeSync(request, [version]) ⇒ Buffer

Serialize a structure request

Kind: instance method of MQSerializer
Returns: Buffer - resolves with serialized message
Access: public

Param Type Default Description
request Object message to be serialized
[version] String '1' default version for serializing message

mqSerializer.unserialize(request) ⇒ Promise.<Object>

Promisified unserialize

Kind: instance method of MQSerializer
Returns: Promise.<Object> - resolves with unserialized message
Access: public

Param Type Description
request Buffer message to be unserialized

mqSerializer.unserializeSync(request) ⇒ Object

Unserialize synchronous

Kind: instance method of MQSerializer
Returns: Object - unserialized message
Access: public

Param Type Description
request Buffer message to be unserialized

itavy/mq-structure : object

Kind: global namespace

TODO

  • Examples

LICENSE

MIT