Skip to content

etorres/train-station

Repository files navigation

Train Station

GitHub Workflow Status Codecov Scala Steward badge Mergify Status

This is an adaptation of the blog entry Event-driven railway network based on Pulsar (by Pavels Sisojevs) to the following stack:

Configuration

Required properties:

STATION=Barcelona
CONNECTED_STATIONS=Madrid,Valencia
JDBC_PASSWORD=changeme

Optional properties:

CI=true

Examples

curl --request POST 
     --url http://localhost:8080/api/v1/departure 
     --header 'content-type: application/json' 
     --data '{
              "trainId": "456", 
              "to": {"station": "Valencia"}, 
              "expected": {"moment": "2021-02-27T21:21:15Z"}, 
              "actual": {"moment": "2021-02-27T22:05:42Z"}
             }'
curl --request POST 
     --url http://localhost:8080/api/v1/arrival 
     --header 'Content-Type: application/json' 
     --data '{
              "trainId": "2b424db4-b111-4f27-8c7c-70f866c3cc50",
              "actual": {"moment":"2021-03-08T22:05:42Z"}
             }'
curl -v --url http://localhost:8080/api/v1/arrival 
        -H 'X-B3-TraceId: 80f198ee56343ba864fe8b2a57d3eff7' 
        -H 'X-B3-ParentSpanId: 05e3ac9a4f6e3b90' 
        -H 'X-B3-SpanId: e457b5a2e4d86bd1' 
        -H 'X-B3-Sampled: 1' 
        -H 'Content-Type: application/json' 
        --compressed 
        --data '{
                 "trainId":"2b424db4-b111-4f27-8c7c-70f866c3cc50",
                 "actual":{"moment":"2021-03-08T22:05:42Z"}
                }'
curl -v --url http://localhost:8080/docs

Useful Links