@@ -20,18 +20,18 @@ Namespace of the AS to service internal requests from the API to create, delete
2020and connect to the internal messaging bus to stream events to a client.
2121
2222The implementation is based on Python and the [ FastAPI] framework, offering
23- _ public_ web-sockets managed by an _ internal_ API, managed by the AS using
24- the required endpoint : -
23+ _ public_ WebSockets managed by an _ internal_ API, managed by the AS using
24+ the required endpoints : -
2525
26- /event-stream POST
27- /event-stream GET
26+ /event-stream/ POST
27+ /event-stream/ GET
2828 /event-stream/{id} DELETE
2929
3030See the AS documentation for more details, and the discussion of the [ Event Streams]
3131service on its internal wiki.
3232
33- The application runs two ** uvicorn** FastAPI processes in the container: -
34- an API listening on port ` 8081 ` , and the web-socket service listening on port ` 8080 ` .
33+ The application runs two ** uvicorn** FastAPI processes in the container.
34+ An API listening on port ` 8081 ` , and the WebSocket service listening on port ` 8080 ` .
3535
3636## Contributing
3737The project uses: -
@@ -111,24 +111,28 @@ to `absent`: -
111111
112112## Troubleshooting
113113The deployed application uses the Python logging framework. Significant events
114- are written to the console, and in a rotating file in ` /loga /es.log ` .
114+ are written to the console, and in a rotating file in ` /logs /es.log ` .
115115
116- Access logging is written to a rotating file handler for ` /loga /access.log` ,
116+ Access logging is written to the rotating file handler ` /logs /access.log` ,
117117and WSGI logging to ` /logs/wsgi.log ` .
118118
119119## Local development
120120You can build and run the service using ` docker compose ` : -
121121
122122 docker compose up --build --detach
123123
124+ And shut it down with: -
125+
126+ docker compose down
127+
124128You can interact with it using ` http ` , where you should be able to create
125129and delete event streams using the internal API. Here we're using
126130` jq ` and ` cut ` to process the response body to simplify the subsequent ** DELETE**
127131request: -
128132
129133To create (** POST** ) an event stream, run the following:
130134
131- ESS_LOC=$(http post localhost:8081/event-stream/ routing_key=0123456789 -b | jq -r ".location")
135+ ESS_LOC=$(http post localhost:8081/event-stream/ routing_key=abc -b | jq -r ".location")
132136 echo $ESS_LOC
133137 ESS_ID=$(echo $ESS_LOC | cut -d/ -f5)
134138 echo $ESS_ID
@@ -152,7 +156,7 @@ read messages from the corresponding web socket: -
152156If you have a websocket you can start a simple listener with the following command,
153157which will print each message received: -
154158
155- ./ws_listener.py <location>
159+ ./ws_listener.py $ESS_LOC
156160
157161You can then * inject* a very simple ** MerchantCharge** message that will be picked up
158162by the client using the command: -
0 commit comments