Skip to content

How To | New Core Unit

zero edited this page Jan 24, 2019 · 3 revisions

Must read Architecture Overview and talk to yourself:

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 core unit, you have to answer these questions:

  1. What purpose for this core unit?
  2. core unit will provides which a list of functions that related to one concept/technology?
  3. Is it already existed?

Your answers will lead your action:

  1. Project Name | GroupId | ArtifactId | PackageName @See: Naming Convention
  2. Define a set of:
    • config: unit configuration for flexible override in deployment
    • registry interface: that will be injected into unit when startup unit. E.g: HttpRouter in :core:httpserver, KafkaRouter in :core:kafka
    • service interface: that used from outside of project, e.g: entityHandler in :core:sql, KafkaConsumerService + KafkaProducerService in :core:kafka
  3. Q3: If it is not existed, go ahead. Or else, improve exited one.

Get started

  • Create new sub Gradle project in right place
  • Add README.md that describes your core unit
  • Provide Unit Config inspired by Verticle Config
  • Create your Vertx Verticle inspired by Verticle Unit
  • Start to implement
  • Add unit test to cover your implementation
Clone this wiki locally