activej / activej

ActiveJ is an alternative Java platform built from the ground up. ActiveJ redefines core, web and high-load programming in Java, providing simplicity, maximum performance and scalability
https://activej.io
Apache License 2.0
880 stars 72 forks source link

How to structure the application? #239

Open romulloal opened 2 years ago

romulloal commented 2 years ago

Hi people, I'm learning ActiveJ.

I code a simple http service using MultithreadedHttpServerLauncher, like the http docs. It just query a h2 database and sends a json response. Today I have a simple class that extends MultithreadedHttpServerLauncher and overrides servlet() method. In servlet() I use BasicAuth and RoutingServlet. There is a hikaricp pool for the database access.

Now I want to code two more services in that app. Each service will open a https connection to another host:port, gets the content, process and return a json.

I read tutorials, docs and examples but I could not understand how to structure that app with Launchers, Modules, Services...

How could I struture that app? (like, a HttpLauncher, a Service1Module, a Service2Module) And how to bind these classes? How should I call the services in a RoutingServlet? I need to configure and use a AsyncHttpClient to connect to host:port, that's ok, but I don't know how the client can be injected?

Thanks in advance.

romulloal commented 2 years ago

Please ignore, as I'm going to read Discussions