Configuration.encodeDubbo()
Description
Appends an encodeDubbo filter to the current pipeline layout.
An encodeDubbo filter encodes Dubbo messages into a raw byte stream.
- INPUT - Dubbo Messages to encode.
- OUTPUT - Encoded Data stream from the input Dubbo messages.
The encoder expects an input Message to have:
- head
- id - Request ID as a string
- status - Status code
- isRequest - Is it a request?
- isTwoWay - Is it 2-way?
- isEvent - Is it an event?
- body - Binary data in the body
The body data is a Data object and will be left unchanged after encoding. To produce data in Hessian format, use Hessian.encode().
Syntax
pipy().pipeline().encodeDubbo()
Parameters
encodeDubbo()
Return Value
The same Configuration object.
Example
pipy().listen(20880).decodeDubbo().demux().to($=>$.replaceMessageBody(data => (JSON.encode(Hessian.decode(data)))).muxHTTP().to($=>$.connect('localhost:8080')).replaceMessageBody(data => (Hessian.encode(JSON.decode(data))))).encodeDubbo({isRequest: false,})