Vertx : how to separate routers to a different class keeping a single verticlevertx verticle instance confusingWhat is the difference between running a vertx verticle and deploying a verticle through another verticle container?Stop vertx verticle in EclipseVertx: Why is there no clustered verticle?Vertx worker verticle pool for jdbcVertx | Global state of Verticles in a clusterWhen the verticle will undeploy in vertxDebug JS Verticle vertxVertx - Stop a verticle instanceVertx multiple servers in one verticles

How fast does a character need to move to be effectively invisible?

Why isn't aluminium involved in biological processes?

Construct, in some manner, a four-dimensional "RegionPlot"

Is there an English equivalent for "Les carottes sont cuites", while keeping the vegetable reference?

What is the meaning of [[:space:]] in bash?

How to determine the optimal threshold to achieve the highest accuracy

FPGA CPU's, how to find the max speed?

Finding the package which provides a given command

Mechanical puzzle ID: Ring, barbell, and four-holed panel

How do I query for system views in a SQL Server database?

How to ask my office to remove the pride decorations without appearing anti-LGBTQ?

A scene of Jimmy diversity

Using two linked programs, output ordinal numbers up to n

Why don't commercial aircraft adopt a slightly more seaplane-like design to allow safer ditching in case of emergency?

Alphanumeric Line and Curve Counting

What details should I consider before agreeing for part of my salary to be 'retained' by employer?

What "fuel more powerful than anything the West (had) in stock" put Laika in orbit aboard Sputnik 2?

How do affixes and prefixes work in Diablo 2?

Is there a standard way of referencing line numbers in a draft?

Snaking a clogged tub drain

Credit card details stolen every 1-2 years. What am I doing wrong?

Why is Katakana not pronounced Katagana?

Animal Shelter Management C++

Link of a singularity



Vertx : how to separate routers to a different class keeping a single verticle


vertx verticle instance confusingWhat is the difference between running a vertx verticle and deploying a verticle through another verticle container?Stop vertx verticle in EclipseVertx: Why is there no clustered verticle?Vertx worker verticle pool for jdbcVertx | Global state of Verticles in a clusterWhen the verticle will undeploy in vertxDebug JS Verticle vertxVertx - Stop a verticle instanceVertx multiple servers in one verticles






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















We have a MainVerticle which is growing with the number of routes such as :



router.get("/vehicles/:id").handler(ctx -> 
LOG.info("Entering get vehicle details");
getVehicleDetailsCounter.inc();
vehicleApiImpl.getVehicleDetails(ctx, httpClient);
);

router.post("/vehicles/:id/journey").handler(ctx ->
// BOOK VEHICLE
LOG.info("Entering book vehicle");
startJourneyCounter.inc();
vehicleApiImpl.startJourney(ctx, httpClient);
);

router.post("/vehicles/:id/trips/:tripId/reports").handler(ctx ->
LOG.info("Entering trip reports");
tripReportsCounter.inc();
getTripReports(ctx, httpClient);
);

router.get("/availableVehicles/:cityId").handler(ctx ->
LOG.info("Entering available vehicles");
availableVehCounter.inc();
getAvailableVehicles(ctx, httpClient);
);

router.get("/zonesDetails/:cityId").handler(ctx ->
LOG.info("Entering zones details");
getZonesDetailsCounter.inc();
vehicleApiImpl.getZonesDetails(ctx, httpClient);
);

router.get("/models").handler(ctx ->
LOG.info("Entering models");
modelsCounter.inc();
vehicleApiImpl.getModels(ctx, httpClient);
);

router.get("/options").handler(ctx ->
LOG.info("Entering options");
optionsCounter.inc();
vehicleApiImpl.getOptions(ctx, httpClient);
);

// ============================
// USER
// ============================
LOG.info("Handler register : USER");

// Payment Details
router.post("/user/notifyAppPaymentTransaction").handler(ctx ->
LOG.info("Entering payment transaction");
notifyAppPaymentTransaction(ctx, httpClient);
);

// The user current journey
router.get("/user/currentJourney").handler(ctx ->
LOG.info("Entering get current journey");
getCurrentJourneyCounter.inc();
userApiImpl.getCurrentJourney(ctx, httpClient);
);

// Create a new user
router.post("/users").handler(ctx ->
LOG.info("Entering create user");
createUserCounter.inc();
createUser(ctx, httpClient);
);


...



We need to keep listening to a single ip : port.
What would be a good idea to break this MainVerticle into several classes while keeping the single verticle?



One obvious way would be static helper classes that take in the router and do the mappings inside. But in case there is an existing pattern in Vertx, using routers for example, it would really help.



Thanks in advance.










share|improve this question




























    1















    We have a MainVerticle which is growing with the number of routes such as :



    router.get("/vehicles/:id").handler(ctx -> 
    LOG.info("Entering get vehicle details");
    getVehicleDetailsCounter.inc();
    vehicleApiImpl.getVehicleDetails(ctx, httpClient);
    );

    router.post("/vehicles/:id/journey").handler(ctx ->
    // BOOK VEHICLE
    LOG.info("Entering book vehicle");
    startJourneyCounter.inc();
    vehicleApiImpl.startJourney(ctx, httpClient);
    );

    router.post("/vehicles/:id/trips/:tripId/reports").handler(ctx ->
    LOG.info("Entering trip reports");
    tripReportsCounter.inc();
    getTripReports(ctx, httpClient);
    );

    router.get("/availableVehicles/:cityId").handler(ctx ->
    LOG.info("Entering available vehicles");
    availableVehCounter.inc();
    getAvailableVehicles(ctx, httpClient);
    );

    router.get("/zonesDetails/:cityId").handler(ctx ->
    LOG.info("Entering zones details");
    getZonesDetailsCounter.inc();
    vehicleApiImpl.getZonesDetails(ctx, httpClient);
    );

    router.get("/models").handler(ctx ->
    LOG.info("Entering models");
    modelsCounter.inc();
    vehicleApiImpl.getModels(ctx, httpClient);
    );

    router.get("/options").handler(ctx ->
    LOG.info("Entering options");
    optionsCounter.inc();
    vehicleApiImpl.getOptions(ctx, httpClient);
    );

    // ============================
    // USER
    // ============================
    LOG.info("Handler register : USER");

    // Payment Details
    router.post("/user/notifyAppPaymentTransaction").handler(ctx ->
    LOG.info("Entering payment transaction");
    notifyAppPaymentTransaction(ctx, httpClient);
    );

    // The user current journey
    router.get("/user/currentJourney").handler(ctx ->
    LOG.info("Entering get current journey");
    getCurrentJourneyCounter.inc();
    userApiImpl.getCurrentJourney(ctx, httpClient);
    );

    // Create a new user
    router.post("/users").handler(ctx ->
    LOG.info("Entering create user");
    createUserCounter.inc();
    createUser(ctx, httpClient);
    );


    ...



    We need to keep listening to a single ip : port.
    What would be a good idea to break this MainVerticle into several classes while keeping the single verticle?



    One obvious way would be static helper classes that take in the router and do the mappings inside. But in case there is an existing pattern in Vertx, using routers for example, it would really help.



    Thanks in advance.










    share|improve this question
























      1












      1








      1








      We have a MainVerticle which is growing with the number of routes such as :



      router.get("/vehicles/:id").handler(ctx -> 
      LOG.info("Entering get vehicle details");
      getVehicleDetailsCounter.inc();
      vehicleApiImpl.getVehicleDetails(ctx, httpClient);
      );

      router.post("/vehicles/:id/journey").handler(ctx ->
      // BOOK VEHICLE
      LOG.info("Entering book vehicle");
      startJourneyCounter.inc();
      vehicleApiImpl.startJourney(ctx, httpClient);
      );

      router.post("/vehicles/:id/trips/:tripId/reports").handler(ctx ->
      LOG.info("Entering trip reports");
      tripReportsCounter.inc();
      getTripReports(ctx, httpClient);
      );

      router.get("/availableVehicles/:cityId").handler(ctx ->
      LOG.info("Entering available vehicles");
      availableVehCounter.inc();
      getAvailableVehicles(ctx, httpClient);
      );

      router.get("/zonesDetails/:cityId").handler(ctx ->
      LOG.info("Entering zones details");
      getZonesDetailsCounter.inc();
      vehicleApiImpl.getZonesDetails(ctx, httpClient);
      );

      router.get("/models").handler(ctx ->
      LOG.info("Entering models");
      modelsCounter.inc();
      vehicleApiImpl.getModels(ctx, httpClient);
      );

      router.get("/options").handler(ctx ->
      LOG.info("Entering options");
      optionsCounter.inc();
      vehicleApiImpl.getOptions(ctx, httpClient);
      );

      // ============================
      // USER
      // ============================
      LOG.info("Handler register : USER");

      // Payment Details
      router.post("/user/notifyAppPaymentTransaction").handler(ctx ->
      LOG.info("Entering payment transaction");
      notifyAppPaymentTransaction(ctx, httpClient);
      );

      // The user current journey
      router.get("/user/currentJourney").handler(ctx ->
      LOG.info("Entering get current journey");
      getCurrentJourneyCounter.inc();
      userApiImpl.getCurrentJourney(ctx, httpClient);
      );

      // Create a new user
      router.post("/users").handler(ctx ->
      LOG.info("Entering create user");
      createUserCounter.inc();
      createUser(ctx, httpClient);
      );


      ...



      We need to keep listening to a single ip : port.
      What would be a good idea to break this MainVerticle into several classes while keeping the single verticle?



      One obvious way would be static helper classes that take in the router and do the mappings inside. But in case there is an existing pattern in Vertx, using routers for example, it would really help.



      Thanks in advance.










      share|improve this question














      We have a MainVerticle which is growing with the number of routes such as :



      router.get("/vehicles/:id").handler(ctx -> 
      LOG.info("Entering get vehicle details");
      getVehicleDetailsCounter.inc();
      vehicleApiImpl.getVehicleDetails(ctx, httpClient);
      );

      router.post("/vehicles/:id/journey").handler(ctx ->
      // BOOK VEHICLE
      LOG.info("Entering book vehicle");
      startJourneyCounter.inc();
      vehicleApiImpl.startJourney(ctx, httpClient);
      );

      router.post("/vehicles/:id/trips/:tripId/reports").handler(ctx ->
      LOG.info("Entering trip reports");
      tripReportsCounter.inc();
      getTripReports(ctx, httpClient);
      );

      router.get("/availableVehicles/:cityId").handler(ctx ->
      LOG.info("Entering available vehicles");
      availableVehCounter.inc();
      getAvailableVehicles(ctx, httpClient);
      );

      router.get("/zonesDetails/:cityId").handler(ctx ->
      LOG.info("Entering zones details");
      getZonesDetailsCounter.inc();
      vehicleApiImpl.getZonesDetails(ctx, httpClient);
      );

      router.get("/models").handler(ctx ->
      LOG.info("Entering models");
      modelsCounter.inc();
      vehicleApiImpl.getModels(ctx, httpClient);
      );

      router.get("/options").handler(ctx ->
      LOG.info("Entering options");
      optionsCounter.inc();
      vehicleApiImpl.getOptions(ctx, httpClient);
      );

      // ============================
      // USER
      // ============================
      LOG.info("Handler register : USER");

      // Payment Details
      router.post("/user/notifyAppPaymentTransaction").handler(ctx ->
      LOG.info("Entering payment transaction");
      notifyAppPaymentTransaction(ctx, httpClient);
      );

      // The user current journey
      router.get("/user/currentJourney").handler(ctx ->
      LOG.info("Entering get current journey");
      getCurrentJourneyCounter.inc();
      userApiImpl.getCurrentJourney(ctx, httpClient);
      );

      // Create a new user
      router.post("/users").handler(ctx ->
      LOG.info("Entering create user");
      createUserCounter.inc();
      createUser(ctx, httpClient);
      );


      ...



      We need to keep listening to a single ip : port.
      What would be a good idea to break this MainVerticle into several classes while keeping the single verticle?



      One obvious way would be static helper classes that take in the router and do the mappings inside. But in case there is an existing pattern in Vertx, using routers for example, it would really help.



      Thanks in advance.







      vert.x






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 8:19









      Orkun OzenOrkun Ozen

      4,5643 gold badges34 silver badges65 bronze badges




      4,5643 gold badges34 silver badges65 bronze badges






















          2 Answers
          2






          active

          oldest

          votes


















          2














          You can for example extract your vehicle routes in a different handler. Then in the handler you can choose to implement your business logic there or better send a message through the eventbus, consume that message in any other Verticle, do your business logic there, and reply with an answer for the message, which you will send as a response.



          router.route("/vehicles/*").handler(VehicleHandler.create(vertx, router));


          VehicleHandler



          public interface VehicleHandler extends Handler<RoutingContext> 
          static VehicleHandler create(Vertx vertx, Router router)
          return new VehicleHandlerImpl(vertx, router);




          VehicleHandlerImpl



          public class VehicleHandlerImpl implements VehicleHandler 

          private Router router;

          public VehicleHandlerImpl(Vertx vertx, Router router)
          this.router = router;
          router.get("/:id/"").handler(this::getVehicle);
          router.post("/:id/trips/:tripId/reports").handler(this::postReports);
          router.post(":id/journey").handler(this::postJourney);


          @Override
          public void handle(final RoutingContext ctx)
          router.handleContext(ctx);


          private void getVehicle(RoutingContext ctx)
          //Option A: do you business logic here


          private void postReports(RoutingContext ctx)
          //Option B: send an eventbus message, handle the message in the MainVerticle and serve the response here


          private void postJourney(RoutingContext ctx)
          //Option C: send an eventbus message, handle the message in a new Verticle and serve the response here







          share|improve this answer

























          • I'm not sure it is fine to create two independent routers. It would be better to either 1/ provide the router in the constructor or 2/ use subrouters

            – tsegismont
            Mar 26 at 10:14











          • I looked into it, the Router.router(vertx) is a singleton so it should be fine. But still it is probably better to pass in the constructor.

            – taygetos
            Mar 26 at 10:45


















          0














          //Main Clss 
          class Main : AbstractVerticle()
          override fun start()
          val router = Router.router(vertx) router.route().handler(BodyHandler.create())
          router.get("/vehicles/:id").handler req ->Controller.get_vehicle(req)
          router.get("/vehicles/:id/journey").handlerreq->Controller.startJourney(req)



          // Controller Class
          open class Controller
          companion object
          fun get_vehicle(routingContext: RoutingContext) // `enter code here`







          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55352588%2fvertx-how-to-separate-routers-to-a-different-class-keeping-a-single-verticle%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            You can for example extract your vehicle routes in a different handler. Then in the handler you can choose to implement your business logic there or better send a message through the eventbus, consume that message in any other Verticle, do your business logic there, and reply with an answer for the message, which you will send as a response.



            router.route("/vehicles/*").handler(VehicleHandler.create(vertx, router));


            VehicleHandler



            public interface VehicleHandler extends Handler<RoutingContext> 
            static VehicleHandler create(Vertx vertx, Router router)
            return new VehicleHandlerImpl(vertx, router);




            VehicleHandlerImpl



            public class VehicleHandlerImpl implements VehicleHandler 

            private Router router;

            public VehicleHandlerImpl(Vertx vertx, Router router)
            this.router = router;
            router.get("/:id/"").handler(this::getVehicle);
            router.post("/:id/trips/:tripId/reports").handler(this::postReports);
            router.post(":id/journey").handler(this::postJourney);


            @Override
            public void handle(final RoutingContext ctx)
            router.handleContext(ctx);


            private void getVehicle(RoutingContext ctx)
            //Option A: do you business logic here


            private void postReports(RoutingContext ctx)
            //Option B: send an eventbus message, handle the message in the MainVerticle and serve the response here


            private void postJourney(RoutingContext ctx)
            //Option C: send an eventbus message, handle the message in a new Verticle and serve the response here







            share|improve this answer

























            • I'm not sure it is fine to create two independent routers. It would be better to either 1/ provide the router in the constructor or 2/ use subrouters

              – tsegismont
              Mar 26 at 10:14











            • I looked into it, the Router.router(vertx) is a singleton so it should be fine. But still it is probably better to pass in the constructor.

              – taygetos
              Mar 26 at 10:45















            2














            You can for example extract your vehicle routes in a different handler. Then in the handler you can choose to implement your business logic there or better send a message through the eventbus, consume that message in any other Verticle, do your business logic there, and reply with an answer for the message, which you will send as a response.



            router.route("/vehicles/*").handler(VehicleHandler.create(vertx, router));


            VehicleHandler



            public interface VehicleHandler extends Handler<RoutingContext> 
            static VehicleHandler create(Vertx vertx, Router router)
            return new VehicleHandlerImpl(vertx, router);




            VehicleHandlerImpl



            public class VehicleHandlerImpl implements VehicleHandler 

            private Router router;

            public VehicleHandlerImpl(Vertx vertx, Router router)
            this.router = router;
            router.get("/:id/"").handler(this::getVehicle);
            router.post("/:id/trips/:tripId/reports").handler(this::postReports);
            router.post(":id/journey").handler(this::postJourney);


            @Override
            public void handle(final RoutingContext ctx)
            router.handleContext(ctx);


            private void getVehicle(RoutingContext ctx)
            //Option A: do you business logic here


            private void postReports(RoutingContext ctx)
            //Option B: send an eventbus message, handle the message in the MainVerticle and serve the response here


            private void postJourney(RoutingContext ctx)
            //Option C: send an eventbus message, handle the message in a new Verticle and serve the response here







            share|improve this answer

























            • I'm not sure it is fine to create two independent routers. It would be better to either 1/ provide the router in the constructor or 2/ use subrouters

              – tsegismont
              Mar 26 at 10:14











            • I looked into it, the Router.router(vertx) is a singleton so it should be fine. But still it is probably better to pass in the constructor.

              – taygetos
              Mar 26 at 10:45













            2












            2








            2







            You can for example extract your vehicle routes in a different handler. Then in the handler you can choose to implement your business logic there or better send a message through the eventbus, consume that message in any other Verticle, do your business logic there, and reply with an answer for the message, which you will send as a response.



            router.route("/vehicles/*").handler(VehicleHandler.create(vertx, router));


            VehicleHandler



            public interface VehicleHandler extends Handler<RoutingContext> 
            static VehicleHandler create(Vertx vertx, Router router)
            return new VehicleHandlerImpl(vertx, router);




            VehicleHandlerImpl



            public class VehicleHandlerImpl implements VehicleHandler 

            private Router router;

            public VehicleHandlerImpl(Vertx vertx, Router router)
            this.router = router;
            router.get("/:id/"").handler(this::getVehicle);
            router.post("/:id/trips/:tripId/reports").handler(this::postReports);
            router.post(":id/journey").handler(this::postJourney);


            @Override
            public void handle(final RoutingContext ctx)
            router.handleContext(ctx);


            private void getVehicle(RoutingContext ctx)
            //Option A: do you business logic here


            private void postReports(RoutingContext ctx)
            //Option B: send an eventbus message, handle the message in the MainVerticle and serve the response here


            private void postJourney(RoutingContext ctx)
            //Option C: send an eventbus message, handle the message in a new Verticle and serve the response here







            share|improve this answer















            You can for example extract your vehicle routes in a different handler. Then in the handler you can choose to implement your business logic there or better send a message through the eventbus, consume that message in any other Verticle, do your business logic there, and reply with an answer for the message, which you will send as a response.



            router.route("/vehicles/*").handler(VehicleHandler.create(vertx, router));


            VehicleHandler



            public interface VehicleHandler extends Handler<RoutingContext> 
            static VehicleHandler create(Vertx vertx, Router router)
            return new VehicleHandlerImpl(vertx, router);




            VehicleHandlerImpl



            public class VehicleHandlerImpl implements VehicleHandler 

            private Router router;

            public VehicleHandlerImpl(Vertx vertx, Router router)
            this.router = router;
            router.get("/:id/"").handler(this::getVehicle);
            router.post("/:id/trips/:tripId/reports").handler(this::postReports);
            router.post(":id/journey").handler(this::postJourney);


            @Override
            public void handle(final RoutingContext ctx)
            router.handleContext(ctx);


            private void getVehicle(RoutingContext ctx)
            //Option A: do you business logic here


            private void postReports(RoutingContext ctx)
            //Option B: send an eventbus message, handle the message in the MainVerticle and serve the response here


            private void postJourney(RoutingContext ctx)
            //Option C: send an eventbus message, handle the message in a new Verticle and serve the response here








            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 26 at 10:42

























            answered Mar 26 at 9:00









            taygetostaygetos

            1,7912 gold badges12 silver badges20 bronze badges




            1,7912 gold badges12 silver badges20 bronze badges












            • I'm not sure it is fine to create two independent routers. It would be better to either 1/ provide the router in the constructor or 2/ use subrouters

              – tsegismont
              Mar 26 at 10:14











            • I looked into it, the Router.router(vertx) is a singleton so it should be fine. But still it is probably better to pass in the constructor.

              – taygetos
              Mar 26 at 10:45

















            • I'm not sure it is fine to create two independent routers. It would be better to either 1/ provide the router in the constructor or 2/ use subrouters

              – tsegismont
              Mar 26 at 10:14











            • I looked into it, the Router.router(vertx) is a singleton so it should be fine. But still it is probably better to pass in the constructor.

              – taygetos
              Mar 26 at 10:45
















            I'm not sure it is fine to create two independent routers. It would be better to either 1/ provide the router in the constructor or 2/ use subrouters

            – tsegismont
            Mar 26 at 10:14





            I'm not sure it is fine to create two independent routers. It would be better to either 1/ provide the router in the constructor or 2/ use subrouters

            – tsegismont
            Mar 26 at 10:14













            I looked into it, the Router.router(vertx) is a singleton so it should be fine. But still it is probably better to pass in the constructor.

            – taygetos
            Mar 26 at 10:45





            I looked into it, the Router.router(vertx) is a singleton so it should be fine. But still it is probably better to pass in the constructor.

            – taygetos
            Mar 26 at 10:45













            0














            //Main Clss 
            class Main : AbstractVerticle()
            override fun start()
            val router = Router.router(vertx) router.route().handler(BodyHandler.create())
            router.get("/vehicles/:id").handler req ->Controller.get_vehicle(req)
            router.get("/vehicles/:id/journey").handlerreq->Controller.startJourney(req)



            // Controller Class
            open class Controller
            companion object
            fun get_vehicle(routingContext: RoutingContext) // `enter code here`







            share|improve this answer



























              0














              //Main Clss 
              class Main : AbstractVerticle()
              override fun start()
              val router = Router.router(vertx) router.route().handler(BodyHandler.create())
              router.get("/vehicles/:id").handler req ->Controller.get_vehicle(req)
              router.get("/vehicles/:id/journey").handlerreq->Controller.startJourney(req)



              // Controller Class
              open class Controller
              companion object
              fun get_vehicle(routingContext: RoutingContext) // `enter code here`







              share|improve this answer

























                0












                0








                0







                //Main Clss 
                class Main : AbstractVerticle()
                override fun start()
                val router = Router.router(vertx) router.route().handler(BodyHandler.create())
                router.get("/vehicles/:id").handler req ->Controller.get_vehicle(req)
                router.get("/vehicles/:id/journey").handlerreq->Controller.startJourney(req)



                // Controller Class
                open class Controller
                companion object
                fun get_vehicle(routingContext: RoutingContext) // `enter code here`







                share|improve this answer













                //Main Clss 
                class Main : AbstractVerticle()
                override fun start()
                val router = Router.router(vertx) router.route().handler(BodyHandler.create())
                router.get("/vehicles/:id").handler req ->Controller.get_vehicle(req)
                router.get("/vehicles/:id/journey").handlerreq->Controller.startJourney(req)



                // Controller Class
                open class Controller
                companion object
                fun get_vehicle(routingContext: RoutingContext) // `enter code here`








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 26 at 13:27









                Jonathan BaptistJonathan Baptist

                1




                1



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55352588%2fvertx-how-to-separate-routers-to-a-different-class-keeping-a-single-verticle%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현