... | ... | @@ -47,6 +47,7 @@ graph LR |
|
|
* *Out of scope*:
|
|
|
- [Performance](https://en.wikipedia.org/wiki/Performance_indicator) data
|
|
|
- Validate if messages are only consumed once (since this is a requirement of MQ)
|
|
|
- Multiple producers / validators (although it's possible)
|
|
|
* *Algorithm* used to prove correct message exchange: Similar to many [blockchains](https://en.wikipedia.org/wiki/Blockchain), a (simplistic) [PoW](https://en.wikipedia.org/wiki/Proof-of-work_system)
|
|
|
|
|
|
## Producer
|
... | ... | @@ -71,10 +72,24 @@ new_block = { |
|
|
|
|
|
The [hash](https://en.wikipedia.org/wiki/Cryptographic_hash_function) generating process (aka publisher in MQ language), will send the generated "block" over to the message exchange. On the other side the validating processes (aka consumer in MQ language) will dequeue one message after the other and validate each of these "block". All blocks received on this end _must_ be [valid](https://en.wikipedia.org/wiki/Validity), in order to pass this test.
|
|
|
|
|
|
## Flowchart, since "A picture is worth a thousand words"
|
|
|
|
|
|
```mermaid
|
|
|
graph LR
|
|
|
subgraph Cloud
|
|
|
AMQP((Message Queue))
|
|
|
end
|
|
|
subgraph Cloud/OnPrem
|
|
|
Producer{Producer} -- send hash --> AMQP
|
|
|
end
|
|
|
subgraph Cloud/OnPrem
|
|
|
AMQP -- "receive (and ack)" --> Validator(Validator)
|
|
|
end
|
|
|
```
|
|
|
|
|
|
# Scenario 2 - Performance
|
|
|
* Scope: Check performance, low level validation of results
|
|
|
* Out of scope: n/a
|
|
|
* Out of scope: Multiple producers/consumers (although possible)
|
|
|
|
|
|
## Producer
|
|
|
|
... | ... | @@ -107,6 +122,20 @@ The consuming process will connect to the message broker and ask for creation of |
|
|
|
|
|
Since messages are only valid for 10 seconds, the consuming process will receive only the messages of the last 10 seconds (~ 10 messages).
|
|
|
|
|
|
## Flowchart, since "A picture is worth a thousand words"
|
|
|
|
|
|
```mermaid
|
|
|
graph LR
|
|
|
subgraph Cloud
|
|
|
AMQP((Message Queue))
|
|
|
end
|
|
|
subgraph Cloud/OnPrem
|
|
|
Producer{Producer} -- "send 'Hello world'" --> AMQP
|
|
|
end
|
|
|
subgraph Cloud/OnPrem
|
|
|
AMQP -- "receive (and ack)" --> Consumer(Consumer)
|
|
|
end
|
|
|
```
|
|
|
|
|
|
# Scenario 4 - Active message acknowledgement/rejection on the consumer side
|
|
|
|
... | ... | @@ -136,6 +165,28 @@ In short: How can the broker know the message is lost if neither an acknowledgem |
|
|
The well known and observed (using default configuration of CloudAMQP) behaviour in this case is: As long as the process that received the message is connected, the broker will put the message into the state 'unacknowledged', since it has to guess/expect that the process is still working on that item. As soon as the process disconnects, the broker will re-queue the messages that are in that 'unacknowledged' status.
|
|
|
Next time a consumer connects these messages will be available again for the process to be consumed.
|
|
|
|
|
|
## Flowchart, since "A picture is worth a thousand words"
|
|
|
|
|
|
```mermaid
|
|
|
graph LR
|
|
|
subgraph Cloud
|
|
|
AMQP((Message Queue))
|
|
|
AMQP -. requeue .-> AMQP
|
|
|
end
|
|
|
subgraph Cloud/OnPrem
|
|
|
Producer{Producer} -- "send 'Hello world'" --> AMQP
|
|
|
end
|
|
|
subgraph /dev/null
|
|
|
Nirvana[Nirvana]
|
|
|
style Nirvana fill:#ccf,stroke:#f66,stroke-width:2px,stroke-dasharray: 5, 5
|
|
|
end
|
|
|
subgraph Cloud/OnPrem
|
|
|
AMQP -- receive --> Consumer(Consumer)
|
|
|
Consumer -. acknowledge .-> AMQP
|
|
|
Consumer -. reject .-> AMQP
|
|
|
Consumer -. loose .-> Nirvana
|
|
|
end
|
|
|
```
|
|
|
|
|
|
# Scenario 5 - [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call) Example
|
|
|
|
... | ... | @@ -154,7 +205,25 @@ In an endless loop, keep increasing a number (starting at 1) and, via RPC over A |
|
|
|
|
|
Return to the client if the number it sent is a prime number or not (True/False).
|
|
|
|
|
|
## RPC server
|
|
|
## Flowchart, since "A picture is worth a thousand words"
|
|
|
|
|
|
```mermaid
|
|
|
graph LR
|
|
|
subgraph Cloud
|
|
|
subgraph AMQP
|
|
|
QuestionQueue(Question Queue)
|
|
|
TempQueue2(Temporary queue for answers)
|
|
|
end
|
|
|
end
|
|
|
subgraph Cloud/OnPrem
|
|
|
Client{Client} -- "ask if X is prime" --> QuestionQueue
|
|
|
TempQueue2 -- send result received from server --> Client
|
|
|
end
|
|
|
subgraph Cloud/OnPrem
|
|
|
QuestionQueue -- "get question" --> RPC(RPC Server)
|
|
|
RPC -- "answer question if X is prime" --> TempQueue2
|
|
|
end
|
|
|
```
|
|
|
|
|
|
# Scenario 6 - Queue instance not available
|
|
|
|
... | ... | |