OCR-D / zenhub

Repo for developing zenhub integration
Apache License 2.0
0 stars 0 forks source link

Listening to the message queue #142

Open tdoan2010 opened 1 year ago

tdoan2010 commented 1 year ago

Description

Processing Servers listen on the queue with the same name with the processor. For example, ocrd-dummy processors listen on ocrd-dummy queue.

The processing servers pull jobs from the queue, execute it, and update the status in the database.

To start the processing server, there are two ways:

# use ocrd tool
$ ocrd processing-server <processor-name> --queue=<queue-address> --database=<database-address>

# use processor name
$ <processor-name> processing-server --queue=<queue-address> --database=<database-address>

Fault tolerance

To increase fault tolerance, manual acknowledgement mode must be used. In this case,

If there is no ACK received (e.g., consumer crash), the queuing system will automatically re-queue the message after timeout. By default, it's 30 minutes. This value might need to be adjusted to fit best to our use case.

Idempotence

If there is something wrong, e.g. network, the message will be sent again to the consumer. Make sure to check the redeliver property to make sure that we don't process a page twice.

Result

Processing servers write the results to the database. Depending on the value specified in the message body, it can decide if it needs to push the result to the message queue or not, and to which queue name.