Skip to content

lavin-ds/ZeissMachineStream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zeiss Machine Stream

Currently, the machines emit their data via a websocket only. You are tasked with ingesting and storing the data, finally exposing it to the frontend dev team via a JSON - based API

You are allowed to use any tool and framework for this job and have complete creative freedom. All framework and architectural choices are up to you, the only requirement is that your project is easily runnable on a Linux / OSX machine, preferrably by using Docker.

Currently, there is only a websocket connection which allows receiving a soft-realtime event stream of machine status updates. The endpoint’s full url is: wss://codingcase.bluesky-ff1656b7.westeurope.azurecontainerapps.io/ws/websocket, the response looks like this:

{ "machine_id": "59d9f4b4-018f-43d8-92d0-c51de7d987e5", "id": "41bb0908-15ba-4039-8c4f-8b7b99260eb2", "timestamp": "2017-04-16T19:42:26.542614Z", "status": "running" }

The status can be either idle, running, finished or errored in which case they will be repaired automatically and a repaired event will be sent before resetting to idle again.

The socket will timeout after 60 seconds.

Solution

  • Language:C#.Net Core
  • Database: Postgres
  • IDE: vsCode
  • Runtime: .Net7.0 Sdk
  • Local Dev: Docker + Service

To run the service via Docker

To watch the app running, you can directly call

docker-compose up --build

on the dockerfile under src. This will bring up the db, db-migrator and the service.

The three endpoints in the service are all Get endpoints. They can be reached by following the path

http://localhost:5000/api/MachineStatus/

  • GetAllMachineStates
  • GetLatestMachineStates
  • GetLatestMachineStateById/{id}

The app will launch at https://localhost:5000/ depending on the free ports.

To run the service locally for dev

Download the .Net7.0 Sdk for the type of OS running on your machine from https://dotnet.microsoft.com/download/dotnet/7.0.

You can launch the dependent services like the db, migrator along with a dummy websocket server.js by calling

docker-compose --file docker-compose-services.yml up --build

under src.

The app will launch at https://localhost:5000/ depending on the free ports.

In dev I have also included the SwaggerUI for local testing and documentation which can be found at https://localhost:5000/swagger. This is only available if you run the dotnet service using the IDE.

The application is split into the MVC controller and a background thread running the websocket communication. You can find them both initialised in Program.cs

I am receiving the ws communication and storing it into the postgres db and exposing this stored information via the api service.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published