Configuration.encodeThrift()
Description
Appends an encodeThrift filter to the current pipeline layout.
An encodeThrift filter encodes Thrift messages into a raw byte stream.
- INPUT - Thrift Messages to encode.
- OUTPUT - Encoded Data stream from the input Thrift messages.
The encoder expects an input Message to have:
- 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
Syntax
pipy().pipeline().encodeThrift()
Parameters
encodeThrift()
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()