Code Monkey home page Code Monkey logo

car-location-microservice's Introduction

Architecture Model

Car Location Implementation based on Microservices Architecture

The complete walk-through tutorial about this implementation, I've published blog post here:

Car Location Implementation based on Microservices Architecture

The goal is to calculate the position of vehicles inside strategic geojson-polygons and serve the cars and polygons via a REST API mostly for demonstration purposes!

The implementation consists of Three microservices implemented in Java using Spring Boot and Spring Cloud:

  • car-position-producer: this microservice has a scheduler for getting car data from an external service and pushing that as an event to the topic of Apache Kafka.

  • car-position-consumer: this microservice has a Kafka listener which consumes events, determined for each car in which polygon and finally save car with polygon id in MongoDB.

  • car-webservices: this microservice expose two rest webservice 1)getVehicleByVin 2)getVehiclesByPolygonId

with this approach, you can scale this project just by adding new resources. you can call car data service even each second, produce events for Kafka, run multiple consumers how much you need and finally getting the car in which polygon with high accuracy.

Technologies

  • Spring Boot
  • Spring Cloud, used for building Microservices applications in Java
  • Spring MVC, for creating RESTful API
  • Apache Kafka, an open-source distributed event streaming platform
  • MongoDB, the most popular NoSQL database for modern apps
  • Docker, for containerization of services
  • Docker-Compose, to link the containers
  • Swagger, Swagger-UI, for API documentation

How to launch

First, you should build and package jar files with Maven.

//mvn clean package

Then, I provided a docker file for each microservice, so you should create an image for each microservice.

//docker build -t car-position-producer .

//docker build -t car-position-consumer .

//docker build -t car-webservices .

Finally, by the docker-compose file, you can launch it.

//docker-compose up

Via the home page (http://localhost:8083/) you can access with swagger to test APIs.

car-location-microservice's People

Contributors

mhipo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.