|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > !Server-Operations - Commands for interacting with a running MCP server (signals, actions) > !Listener-Queue - Commands for managing the Listener Mode queue > MCP. - MCP Server Operations |
SPR Script Language
MCP.ConfigQue
Sets the operational mode of the Listener queue to FIFO (Queue) or LIFO (Stack).
Intention
When using the MCP server in Listener Mode, commands are placed into a queue. This command configures how items are retrieved from that queue by HTP.MCPGetNextCommand.
• QUEUE / FIFO (Default): First-In, First-Out. The first command that arrived is the first one to be retrieved. Behaves like a waiting line.
• STACK / LIFO: Last-In, First-Out. The most recently arrived command is the first one to be retrieved. Behaves like a stack of plates.
This command has no effect when the server is running in Executor Mode.
Illustration
🚶➡️🚶➡️🚶 (Queue) vs 🥞🥞🥞 (Stack)
Syntax
MCP.ConfigQue|$$mode
Parameter Explanation
P1 - $$mode - (String, Required)
A string specifying the desired queue behavior. The value is case-insensitive. Valid values are:
• "QUEUE" or "FIFO" - Sets the mode to First-In, First-Out (Default).
• "STACK" or "LIFO" - Sets the mode to Last-In, First-Out.
Examples
'***********************************
' MCP.ConfigQue - Demonstrate LIFO (Stack) behavior
'***********************************
' Start server in listener mode
MCP.Start||1
PAU.500|ms
' Set the mode to STACK
MCP.ConfigQue|STACK
' Send two commands via a TCP client
TCP.Open|127.0.0.1|5556|$$SAA
TCP.Send|$$SAA|First Command
TCP.Close|$$SAA
PAU.100|ms
TCP.Open|127.0.0.1|5556|$$SAA
TCP.Send|$$SAA|Second Command
TCP.Close|$$SAA
PAU.200|ms
' Retrieve commands. The second one sent should come out first.
HTP.MCPGetNextCommand|$$CMD
MBX.First item retrieved (LIFO): $$CMD
HTP.MCPGetNextCommand|$$CMD
MBX.Second item retrieved (LIFO): $$CMD
MCP.Stop
Remarks
- The default mode upon initialization is QUEUE (FIFO). You only need to call this command if you require STACK (LIFO) behavior.
- This setting can be changed at any time while the Listener server is running. It will affect the next call to HTP.MCPGetNextCommand.
See also: