In Rust and TCL, AMQP client libraries currently don't give satisfaction.
As a workaround, and also to allow more universal consumers, we provide an AMQP to HTTP gateway as microservice.
API specification
| 1 | /delivery | 
|---|---|
| 2 | |
| 3 | /delivery/register_consumer | 
| 4 | |
| 5 | { | 
| 6 | "api-key": "<guid allowed to use this API>" | 
| 7 | "routing-key": "nasqueron.*" | 
| 8 | } | 
| 9 | |
| 10 | { | 
| 11 | "key": "<key to use for this queue>" | 
| 12 | } | 
| 13 | |
| 14 | /delivery/get_all | 
| 15 | |
| 16 | { | 
| 17 | "key": "<key returned by register_consumer>" | 
| 18 | "no-ack": false, | 
| 19 | } | 
| 20 | |
| 21 | { | 
| 22 | "queue": "<key to use for this queue>" | 
| 23 | "routing-key": "nasqueron.*" | 
| 24 | "count": 4, | 
| 25 | 'messages": [ | 
| 26 | {}, | 
| 27 | {}, | 
| 28 | {}, | 
| 29 | {} | 
| 30 | ] | 
| 31 | } | 
| 32 | |
| 33 | /delivery/get | 
| 34 | |
| 35 | { | 
| 36 | "key": "<key returned by register_consumer>", | 
| 37 | "format": "base64", | 
| 38 | "no-ack": false, | 
| 39 | } | 
| 40 | |
| 41 | // returns directly the message | 
| 42 | |
| 43 | /delivery/ack | 
| 44 | |
| 45 | { | 
| 46 | "key": "<key returned by register_consumer>", | 
| 47 | "id": 100 | 
| 48 | } | 
| 49 | |
| 50 | OR | 
| 51 | |
| 52 | { | 
| 53 | "key": "<key returned by register_consumer>", | 
| 54 | ids: [ | 
| 55 | 101, | 
| 56 | 102, | 
| 57 | 103, | 
| 58 | 104 | 
| 59 | ] | 
| 60 | } | 
| 61 | |
| 62 | /delivery/unregister_consumer | 
| 63 | |
| 64 | { | 
| 65 | "key": "<key returned by register_consumer>", | 
| 66 | "force": true | 
| 67 | } | 
| 68 | |
| 69 | // `force` allows to specify if we want to drop the queue when there is still at least one message inside | 
| 70 | |
| 71 | Message | 
| 72 | |
| 73 | { | 
| 74 | "id": 100, | 
| 75 | "format": "as-is", | 
| 76 | "content": "..." | 
| 77 | } | 
| 78 | |
| 79 | { | 
| 80 | "id": 100, | 
| 81 | "format": "base64", | 
| 82 | "content": "..." | 
| 83 | } | 
| 84 | |
| 85 | Should we store the content as base64? | 
| 86 | |
| 87 | nginx | 
| 88 | |
| 89 | location /delivery { | 
| 90 | proxy_pass http://localhost:38080/; | 
| 91 | include proxy_params; | 
| 92 | } | 
| 93 | |
| 94 | Should we provide a CSS file too? | 
| 95 | |
| 96 | location = /delivery/app.css { | 
| 97 | try_files /app.css @404; | 
| 98 | } | 
Methods:
- /delivery/register_consumer
- /delivery/get_all
- /delivery/get
- /delivery/ack
- /delivery/unregister_consumer