Agent Bus 002 - jmadison222/knowledge GitHub Wiki
| Home |
-
Linux is the operating system
-
Python is the programming language.
-
Invocation is from the command line.
-
Key components of the system are shown in all capitals in the requirements for clarity.
-
Do not use all capitals for objects in the code. Favor camel case where reasonable.
-
The PRODUCER and CONSUMER will pass a MESSAGE.
-
The MESSAGE contains the fields OPERATION, OPERAND-1, OPERAND-2, ANSWER.
-
The format of the MESSAGE is JSON.
-
The invocation of the PRODUCER from the command line is done with "python producer.py"
-
The PRODUCER listens to TCP/IP port 30101.
-
The PRODUCER consumes a MESSAGE from the TCP/IP port.
-
The PRODUCER finds the OPERATION in the MESSAGE.
-
If the OPERATION is "multiply", the PRODUCER determines the product of OPERAND-1 and OPERAND-2 as the ANSWER
-
If the OPERATION is "add", the PRODUCER determines the sum of OPERAND-1 and OPERAND-2 as the ANSWER.
-
The PRODUCER builds a message to return in the manner prescribed next.
-
The PRODUCER puts all the original parts of the message it received so that the inputs are traceable.
-
The PRODUCER puts the ANSWER into the MESSAGE.
-
The PRODUCER shows the message on the command line so the USER can see the content.
-
The PRODUCER sends the MESSAGE over the TCP/IP port so the CONSUMER can receive it.
-
The PRODUCER waits for another message.
-
The PRODUCER runs indefinitely until a USER sends Control-C.
-
The invocation of the CONSUMER from the command line is done with "python consumer.py"
-
Some number of parameters may be passed on the command line.
-
The first parameter is the name of an OPERATION.
-
The second parameter is OPERAND-1.
-
The third parameter is OPERAND-2.
-
If any parameters are not present, the user is given a help message on how to properly pass parameters.
-
The CONSUMER puts the OPERATION, OPERAND-1, and OPERAND-2 into the MESSAGE format that is common to both the PRODUCER and CONSUMER.
-
The CONSUMER leaves the ANSWER blank.
-
The CONSUMER connects to TCP/IP port 30101 and sends the MESSAGE it has built.
-
The CONSUMER waits for a MESSAGE from the PRODUCER to come over the TCP/IP port.
-
When a return MESSAGE is received from the PRODUCER, the CONSUMER displays it on the screen for the USER.
-
The USER is a human at the Linux command line.
-
The USER will invoke the PRODUCER for it to run indefinitely.
-
The USER will invoke the CONSUMER each time it needs an ANSWER by running "python consumer.py" with parameters.
-
The USER may provide different parameters to the CONSUMER each time the CONSUMER is run.