POST /place-order
{
"coffees" : [
{ "product": "COFFEE", "count": 1 }
]
}
{
"orderId": "00000000-AAAA-AAAA-AAAA-000000000000",
"orderPlaced": "2019-08-01T00:00:00.000Z",
"orderSize": 1
}
GET /order-history
This returns the entire history. When the API is called, the Cashier first tries to process open jobs before answering.
[
{
"orderId" : "00000000-FFFF-FFFF-FFFF-000000000000",
"orderPlaced" : "2019-07-31T01:00:00.000Z",
"orderSize": 2,
"jobs":
[
{
"jobId": "00000000-2222-2222-2222-000000000000",
"product": "KAKAO",
"machine": "http://localhost:1337",
"jobStarted": "2019-07-31T01:00:01.000Z"
},
{
"jobId": "00000000-1111-1111-1111-000000000000",
"product": "KAKAO",
"machine": "http://localhost:1337",
"jobStarted": "2019-07-31T01:01:01.000Z"
}
]
},
{
"orderId": "00000000-AAAA-AAAA-AAAA-000000000000",
"orderPlaced": "2019-08-01T00:00:00.000Z",
"orderSize": 1,
"jobs":
[
{
"product": "COFFEE"
}
]
}
]
GET /order-history/:orderId
This returns the data for the specified order. When the API is called, the Cashier first tries to process open jobs before answering.
{
"orderId": "00000000-AAAA-AAAA-AAAA-000000000000",
"orderPlaced": "2019-08-01T00:00:00.000Z",
"orderSize": 1,
"jobs":
[
{
"product": "COFFEE"
}
]
}
GET /queued-jobs
When the API is called, the Cashier first tries to process open jobs before answering.
{
"count": Integer,
"jobs": [
{
"product": "COFFEE",
"orderId": "00000000-AAAA-AAAA-AAAA-000000000000",
"orderPlaced": "2019-08-01T00:00:00.000Z",
"orderSize": 1
}
]
}
POST /process-jobs
Iterate over non-processed jobs and over all Coffee Machines to try and deploy them. On successful deployment, the jobStarted is updated.
{
}
| Code | Content |
|---|---|
200 |
{"message: "X jobs deployed, Y jobs still queued."} |
Provide URLs to the Coffee Machines.
POST /configure
{
"coffeemachines" : ["http://localhost:1234", "http://localhost:5678"]
}
GET /metrics
# HELP cashier_queue_length The current queue length.
# TYPE cashier_queue_length gauge
cashier_queue_length 0