Closed asthanasid closed 8 years ago
See : https://github.com/aesteve/nubes-issue-55
It should do what you want.
If you could submit a small runnable example when you have an issue it would help me alot.
Since I can :
For instance here the issue is probably not within the code you sent me :(
I have put the code which is not working for me here
https://github.com/asthanasid/nubes-issue-55
one difference is that i am using the convention if 'src-package' key instead of specifically mentioning controller packges, but i guess it should not make a difference.
I'll have a look tomorrow, I don't have enough time this evening, sorry :(
The major difference is not the src-package
but the way you instantiate the router. You're creating a router, passing it to nubes, but you're attaching it to the httpserver before nubes is bootstrapped.
Try moving : https://github.com/asthanasid/nubes-issue-55/blob/master/src/main/java/com/collatrice/frontend/FrontEnd.java#L52
-> line 66
And also, @Override
the start(Future<Void> future)
method (not the start()
method) from AbstractVerticle
since you're doing asynchronous stuff.
And after nubes is bootstrapped (bootstrapping is async) which means : line 66, call :
server.requestHandler
(you can attach the router now that nubes has created the routes)server.listen
(your server can now listen to connections, it's ready)future.complete()
(you notify Vert.x that your verticle is up and running)Not sure it's the cause of your issue, but it could be.
Hope this helps.
Note : you can also do it the other way around . Start by bootstrapping nubes, get the router
nubes created for you, then attach your own routes (the sockjsHandler) to it.
Note² : once it works, you could also consider giving a try to Nubes' annotated eventbusbridge
It worked when initializing the http server after nubes bootstrap. It did not need the asynch version of start though! will need experiment to what difference does it make.
Thanks for the pointer :) I guess i am still getting my head wrapped around ways of Vertx. Its kind of weird that eventbus need to be/can be initialized after http server but routes cant be added
Please find attached the controller class. I can see that the route is added in the vertx web router at /data/dashboard. But when i execute /data/dashboard url i get a not found message on browser. Cant find any thing in the documentation where i might be going wrong RestController.txt