Skip to content

imec-int/pill-booking-service

Repository files navigation

Pill booking service

This microservice is responsible for creating bookings in the Pill service. It receives kafka messages with vessel information. On receiving a message, it creates a booking in the Pill service and sends a message back to the kafka topic with the booking information.

Getting Started

Installation

Requires Python 3.12 and Poetry.

Install the dependencies from the ./pyproject.toml file:

poetry install

Each update to the ./pyproject.toml should be followed by a lock file update:

poetry update

Docker Compose

To run the service with kafka and a mock server.

poetry run compose_up

To stop the containers:

poetry run compose_down

Configuration

The service can be configured with a config.yaml file or environment variables. If you are using docker compose to run the project you can use the following config.yaml file:

kafka_config:
  port: 9094

booking_service_config:
  port: 1080
  scheme: http

Producing a message

It's recommended to use a tool like kaf

echo '{"id":"urn:ngsi-ld:Notification:5e943336-00b7-11ef-b1e3-eabe463564c4","type":"Notification","subscriptionId":"urn:ngsi-ld:Subscription:544cb506-00b7-11ef-b1e3-eabe463564c4","notifiedAt":"2024-04-22T14:48:23.750Z","data":{"id":"urn:ngsi-ld:Vessel:244700713","type":"Vessel","location":{"type":"GeoProperty","value":{"type":"Point","coordinates":[8.430035,49.256163]},"observedAt":"2024-04-22T14:15:52.000Z"},"mmsi":{"type":"Property","value":"244700713","observedAt":"2024-04-22T14:15:52.000Z"},"name":{"type":"Property","value":"DESTINO","observedAt":"2024-04-22T14:15:52.000Z"},"courseOverGround":{"type":"Property","value":239.100006,"observedAt":"2024-04-22T14:15:52.000Z"},"speedOverGround":{"type":"Property","value":5.2,"observedAt":"2024-04-22T14:15:52.000Z"},"dataProvider":{"type":"Property","value":"Spire Terrestrial","observedAt":"2024-04-22T14:15:52.000Z"},"destinationPort":{"type":"Property","value":"CISAT OTT","observedAt":"2024-04-22T14:15:52.000Z"},"estimatedTimeOfArrival":{"type":"Property","value":"2024-04-23T18:00:00Z","observedAt":"2024-04-22T14:15:52.000Z"},"positionAccuracy":{"type":"Property","value":0,"observedAt":"2024-04-22T14:15:52.000Z"},"PlannedWeekOfArrival":{"type":"Property","value":17,"observedAt":"2024-04-22T14:15:52.000Z"},"PlannedDateOfArrival":{"type":"Property","value":"2024-04-22T13:00:00Z","observedAt":"2024-04-22T14:15:52.000Z"},"PlannedTimeOfArrival":{"type":"Property","value":"13:00:00","observedAt":"2024-04-22T14:15:52.000Z"},"Status":{"type":"Property","value":"InTransit","observedAt":"2024-04-22T14:15:52.000Z"},"coils":{"type":"Property","value":149,"observedAt":"2024-04-22T14:15:52.000Z"},"cargoWeight":{"type":"Property","value":2381.355957,"observedAt":"2024-04-22T14:15:52.000Z"}}, "metadata": {"client": "arcelor_mittal"}}' | kaf produce syt.voyage.delay.1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published