Skip to content
ted-dunstone edited this page Jul 31, 2014 · 22 revisions

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

Suggested CLI

# 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)

Example

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

  1. TH_Immigration subscribes to only the TH_Immigration queue
  2. AU_Immigration subscribes to the AU_Immigration queue and the Australia_NZ_Queue
  3. NZ_Immigration subscribes to the NZ_Immigration queue and the Australia_NZ_Queue

Example sent message from Thailand Immigration (TH_Immigration) to 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

Internal broker messages:

  1. List to Australia_NZ_Queue (and all requistered queues) for all messages with topic request.#
  2. Remove from queue
  3. Decode and determine what need to be processed
  4. Add Australia_NZ_Queue with the specified workflow 'action' topic i.e.tranformation.high.authentication.TH_Immigration.001.useri
  5. When all workflow items are done add msg with the match topic match.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

Example received match at both Australia and NZ:

At each country in Australia_NZ_Queue (i.e. Austalia and NZ)

  1. listen to queue Australia_NZ_Queue with topic match match.#
  2. 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

Example received response at Thailand:

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)