-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This open biometric broker relies on RabbitMQ and topic exchanges (tutorial).
The topic queue system
<ACTION>.<priority>.<msgtype>.<reciever_agency_id>.<messageid>.<operatorid>
One queue per agency - actions are specified by the first item in the topic:
-
request
: The initial request message - ``transform```: If a transformation is required
-
match
: When the message is ready to be matched -
response
: The results from any matching -
error
: If there are errors
# to send a message
python send_msg.py -i:<MY_AGENCY_ID> -q:<TO_QUEUE> -t:<TYPE> -p:<PRIORITY> -f:<DATAFILE> -r:RabbitMQ_Addr
e.g.
python send_msg.py -i:TH_Immigration -q:Australia_NZ_Queue -t:Authentication -p:High -f:Test.eft -r:127.0.0.1
# start the hub_receiver (which starts the workflow)
python hub_receiver.py
# start the hub_transformer (which transforms messages)
python hub_receiver.py
# start matcher
python matcher.py -i:<MY_AGENCY_ID> -l:<QUEUES_TO_LISTEN> -r:RabbitMQ_Addr
e.g.
# Australia
python process.py -l:Australia_NZ_Queue,AU_Immigration -i:AU_Immigration -r:127.0.0.1
# NZ
python process.py -l:Australia_NZ_Queue,NZ_Immigration -i:NZ_Immigration -r:127.0.0.1
# TH
python process.py -l:TH_Immigration -i:TH_Immigration -r:127.0.0.1
So for the above simple example there are at least 5 processes that are running continuously:
- The AU and NZ immigration matchers (process.py)
- The Hub receiver
- The Hub transformer
- The TH receiver that gets the received results or any errors (process.py)
For this example a message is being sent from Thailand immigration - its unique ID is TH_Immigration to the Australia_NZ_Queue which has members AU_Immigration and NZ_Immigration. So there are four queues:
TH_Immigration,Australia_NZ_Queue, AU_Immigration and NZ_Immigration
- TH_Immigration subscribes to only the TH_Immigration queue
- AU_Immigration subscribes to the AU_Immigration queue and the Australia_NZ_Queue
- NZ_Immigration subscribes to the NZ_Immigration queue and the Australia_NZ_Queue
Outgoing topic (send on queue Australia_NZ_Queue)
(high priority message from agency TH_Immigration to the group Australia_NZ_Queue with id 001 submitted by userid)
<ACTION>.<priority>.<msgtype>.<reciever_agency_id>.<messageid>.<operatorid>
e.g.
request.high.authentication.TH_Immigration.001.userid
- List to Australia_NZ_Queue (and all requistered queues) for all messages with topic
request.#
- Remove from queue
- Decode and determine what need to be processed
- Add Australia_NZ_Queue with the specified workflow 'action' topic i.e.
tranformation.high.authentication.TH_Immigration.001.useri
- When all workflow items are done add msg with the
match
topicmatch.high.authentication.TH_Immigration.001.userid
If there is an error put it back on the TH_Immigration queue with the topic 'error'
error.high.authentication.TH_Immigration.001.userid
At each country in Australia_NZ_Queue
(i.e. Austalia and NZ)
- listen to queue Australia_NZ_Queue with topic match
match.#
- undertake matches at local point then each matcher put result in TH_Immigration queue as
- From Australia:
response.high.authentication.TH_Immigration.001.userid.AU_Immigration
- From Australia:
response.high.authentication.TH_Immigration.001.userid.NZ_Immigration
Incoming response message (in the TH_Immigration)
listen to queue TH_Immigration with topicresponse.#
also listen to queue TH_Immigration with topicerror.#
(if there are any errors)