Knotx / knotx

Knot.x is a highly-efficient and scalable integration framework designed to build backend APIs
https://knotx.io
Apache License 2.0
126 stars 26 forks source link

KnotxStarterVerticle should allow to build modules starting child verticles #402

Closed marcinczeczko closed 5 years ago

marcinczeczko commented 6 years ago

Version used

Context of the issue/feature

Currently, KnotxStarterVerticle is used to start whole Knotx based on the modules section of the configuration. It should be possible to encapsulate all custom project modules as one module listed in the knotx configuration. Such encapsulated module should utilize KnotxStartVerticle capabilities to start it's own specific verticles listed in the logs as child verticles. It will allow to build more modular configuration, where core knotx modules are split from custom project specific ones

Bug reproducer

N/A/

Steps to reproduce

Appendix

E.g. using hocon format

modules = [
   "server=io.knotx.core.KnotxServer"
   "otherCore=io.knotx.core.OtherStuff"
   "projectXModule=com.acme.Starter"
]
config {
  server {}
  otherCore {}
  projectXModule { include required("my-project-module.conf"}
}

Then on my project, I can concentrate on setting up project specific stuff

modules = [
   "fancy=com.acme.FancyAdapter"
   "foo=com.acme.MyFooVerticle"
]
config {
  fancy {}
  foo {}
}

The log would print out it as follows:

21:44:12.401 [vert.x-eventloop-thread-0] INFO io.knotx.launcher.KnotxStarterVerticle - Knot.x STARTED
                Deployed fsRepo=java:io.knotx.repository.fs.FilesystemRepositoryConnectorVerticle [9d71c2bb-4002-42cd-8802-2b3c9bd532f9]
                Deployed splitter=java:io.knotx.splitter.FragmentSplitterVerticle [892f4917-78af-432e-addb-2a0568fc7fda]
                Deployed assembler=java:io.knotx.assembler.FragmentAssemblerVerticle [6a763216-026d-4bd2-9e36-eba709cf613c]
                Deployed server=java:com.acme.server.KnotxServerVerticle [07fb1307-f627-4e00-9af1-6dbfc7393cf2]
                    Deployed as child fancy=java:com.acme.FancyAdapter [6a763216-026d-4bd2-9e36-eba709cf613c]
                    Deployed as child foo=java:com.acme.MyFooVerticle [07fb1307-f627-4e00-9af1-6dbfc7393cf2]              
marcinczeczko commented 6 years ago

@Skejven @tomaszmichalak - do we still need that feature, what do you think ?

tomaszmichalak commented 5 years ago

@marcinczeczko yes but we can have the same effect with correct configuration files concatenation, see:

https://github.com/Knotx/knotx-stack/blob/master/knotx-stack-manager/src/main/packaging/conf/application.conf https://github.com/Knotx/knotx-stack/blob/master/knotx-stack-manager/src/main/packaging/conf/knots/dataBridgeStack.conf

With this approach all complex modules can be defined as stacks and included as separate files.