Configuration.decodeThrift()
Description
Appends a decodeThrift filter to the current pipeline layout.
A decodeThrift filter decodes Thrift messages from a raw byte stream.
- INPUT - Data stream to decode Thrift messages from.
- OUTPUT - Thrift Messages decoded from the input Data stream.
After decoding, the output Message has:
- head
- seqID - Sequence ID as a number
- type - Type of the message: "call", "reply", "exception" or "oneway"
- name - Name of the message
- protocol - Encoding protocol: "binary" or "compact"
- body - Payload of the message in raw binary
- tail
- payload - Payload of the message decoded as an object (only when option payload is set to true)
Syntax
pipy().pipeline().decodeThrift()pipy().pipeline().decodeThrift({payload: true})
Parameters
decodeThrift()
Return Value
The same Configuration object.
Example
pipy().listen(9000).decodeThrift().demuxQueue({isOneWay: msg => msg.head.type === 'oneway',}).to($=>$.muxQueue({isOneWay: msg => msg.head.type === 'oneway',}).to($=>$.encodeThrift().connect('localhost:9090').decodeThrift())).encodeThrift()