4.7. Spool startup

Upon startup the spool directory (spool.path directive) is scanned for queued messages (.hqf files). The queue files are check for read and write permission by the running process (so that they may be updated and unlinked). The files are then opened and parsed by multiple concurrent threads (spool.loader.threads directive) before either adding them to the defer queue, hold queue or active queue.

  • If there is an error during the load the file is skipped and an error is logged.

  • If the file is empty or contains no queue information (hence from an incomplete transaction), you may choose to unlink, rename, ignore the file (spool.corrupt directive)

4.8. On-disk format

Queued messages and their metadata is written to disk, so that they can be re-loaded into the MTA in case the smtpd program is restarted. The on-disk metadata can be inspected with the hqfcat Python script:

$ hqfcat /var/spool/halon/queue/66/662ffb4a-02d1-11ea-bcf7-06f091ceb4dc.hqf
[
  {
    "status": "QUEUE",
    "retry": 23,
    "retryts": 1573508496,
    "transportid": "mx",
    "ts": 1573290908,
    ...

which produces an output similar to the regular command line interface:

$ halonctl queue list --id b186d406-0c36-11ea-8dda-005056914940:1 --json
[
  {
    "localips": [],
    "tags": [],
    "metadata": {},
    "id": {
      "transaction": "b186d406-0c36-11ea-8dda-005056914940",
      "queue": 1
    },
    ...

You can view the message including modifications made by the end-of-DATA script using the hqfeml script. The -R flag is the recipient queue id. Without the -R flag the original message is displayed. By comparing the hqfeml output with the original message, you can see the modifications:

$ hqfeml -R 1 /var/spool/halon/queue/b1/b186d406-0c36-11ea-8dda-005056914940.hqf