Skip to content

A microservice for accessing the realistic time series generator.

License

Notifications You must be signed in to change notification settings

cetic/tsimulus-ms

Repository files navigation

License

Tsimulus-ms

A microservice for accessing the TSimulus time series generator.

This project intend to provide a micro-service that exposes the features of the TSimulus library through a simple HTTP connection.

It provides a runnable JAR file that contains an Akka-based microservice.

How to use it?

> java -jar tsimulus-ms-1.6.jar -h 0.0.0.0 -p 8001

This command will ask the service to listen to incoming connections on port 8001 from any client. Replace 0.0.0.0 by localhost for limiting the access to the service to clients running on your machine.

Once running, the service can be accessed by submitting POST request to port 8001:

  • POST /generator => Expects a JSON document describing a generator configuration as its POST parameter. The result is a sequence of comma separated lines, each of containing a value of a generated time series.
  • POST /generator/<date> => Expects a JSON document describing a generator configuration as its POST parameter. The date must have the yyyy-MM-dd'T'HH:mm:ss.SSS format. The result is a sequence of comma separated lines, each of containing a value of a generated time series. The sequence covers time series values from the beginning of the generation to the given date.
  • POST /generator/<d1>/<d2> => Expects a JSON document describing a generator configuration as its POST parameter. The dates must have the yyyy-MM-dd'T'HH:mm:ss.SSS format. The result is a sequence of comma separated lines, each of containing a value of a generated time series. The sequence covers time series values from <d1> to <d2>.

The syntax of JSON documents is described in the TSimulus library documentation.

Tsimulus-ms with Docker

You can also retrieve the Docker image which contains the Tsimulus microservice. The Docker image has been created with a Dockerfile.

  • Pull the Docker image
docker pull ceticasbl/tsimulus-ms:1.6
  • Run the microservice: this command launches the Tsimulus microservice on port 8001.
docker run --name tsimulus-ms -ti -p 8001:8001 -d ceticasbl/tsimulus-ms:1.6

When it's done, as explained in the previous section "How to use it?", the service can be accessed by submitting POST request to port 8001.

The Docker image is published with Github Actions and Sbt Native Package.