module mq
message queue module
object
Message
Create a message object, seeMessage
1Message mq.Message;
HttpHandler
Createhttpprotocol handler object, seeHttpHandler
1HttpHandler mq.HttpHandler;
Handler
Create a message handler object, pass the value of the built-in handler and return it directly
1Handler mq.Handler;
Return result:
- Returns the handler that encapsulates the handler function
hdlr accepts built-in message handlers, handler functions, chained processing arrays, and route objects:
- Function javascript function, which will be used for processing
- HandlerBuilt-in processor, which will be used for processing
- Chaining arrays is equivalent to returning newmq.Chain(hdlr), seeChain
- Route object, equivalent to returning newmq.Routing(hdlr), seeRouting
The syntax of the message handler function is as follows:
1function func(v) {}
The parameter v is the message being processed, and there are four types of returned results:
- Function javascript function that will be used for the next stage of processing
- HandlerBuilt-in processor, which will be used for the next stage of processing
- Chaining arrays, equivalent to newmq.Chain(v), seeChain
- routing object, equivalent to newmq.Routing(v), seeRouting
No return or other return results will end message processing.
Chain
Create a message handler chain processing object, seeChain
1Chain mq.Chain;
Routing
Create a message handler route object, seeRouting
1Routing mq.Routing;
static function
nullHandler
Create an empty handler object, and the secondary handler object returns directly without any processing
1static Handler mq.nullHandler();
Return result:
- Handler, returns an empty handler
invoke
Process a message or object using the given handler
1
2static mq.invoke(Handler hdlr,
object v) async;
Call parameters:
Unlike the handler's invoke method, this method will loop through each handler's return handler until the handler returns null.