npm install @itavy/mq-structure
- MQMessage
MQMessage factory class
- MQSerializer
MQSerializer class
- itavy/mq-structure :
object
MQMessage factory class
Kind: global class
- MQMessage
- .fromSync(request, [version]) ⇒
MQMessageV1
- .from(request, [version]) ⇒
Promise.<MQMessageV1>
- .setPBSerializer([sourceIdentifier]) ⇒
undefined
- .fromSync(request, [version]) ⇒
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 |
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 |
set Protobuf singleton serializer
Kind: static method of MQMessage
Access: public
Param | Type | Default | Description |
---|---|---|---|
[sourceIdentifier] | String |
'itavy.mq-structure' |
sourceIdentifier |
MQSerializer class
Kind: global class
- MQSerializer
- new MQSerializer(serializationSchema)
- .serialize(request, [version]) ⇒
Promise.<Buffer>
- .serializeSync(request, [version]) ⇒
Buffer
- .unserialize(request) ⇒
Promise.<Object>
- .unserializeSync(request) ⇒
Object
Param | Type | Description |
---|---|---|
serializationSchema | Object |
serializationSchema |
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 |
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 |
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 |
Unserialize synchronous
Kind: instance method of MQSerializer
Returns: Object
- unserialized message
Access: public
Param | Type | Description |
---|---|---|
request | Buffer |
message to be unserialized |
Kind: global namespace
- Examples