Skip to content

How To | New Service

Aidan P edited this page Jun 22, 2019 · 10 revisions

Must read Architecture Overview

Micro service must be designed with these rules:

  • Single responsibility principle: do only one purpose
  • Itself configurable, and itself testable
  • Communicates with each other via eventbus

Before you start writing new microservice, you have to answer these questions:

  1. What purpose for this service?
  2. Where is this service integrated?
  3. List functions that service provides or uses? E.g: RESTful API for end user, storage data in Database or Kafka communication
  4. Is it already existed?

Your answers will lead your action:

  1. Question 1 and 2: Project Name | GroupId | ArtifactId | PackageName @See: Naming Convention
  2. Q3: List core unit will be used.
  3. Q4: If it is not existed, go ahead. Or else, maybe one of actions:
    • Same integrated location, same purpose: update existed one
    • Same integrated location, different purpose: split the common part between new one and existed one to new project, then group them(3 projects) into one groupId (means: same parent project). After that, adding common part in dependencies of the existed one and new project
    • Different integrated location(e.g: existed on Dashboard but new one will be in Edge): Split the common part to new project into :core and make the existed one and new project depends on new core unit

Get started

  • Create new sub Gradle project in right place
  • Add README.md that describes your project
  • Create your Vertx Verticle inspired by Verticle Container and register a set of core unit in container
  • Consider overriding config from set of core unit and add more your application configuration if needed
  • Start to implement your business domain
  • Add unit test to cover your implementation
Clone this wiki locally