These are chat archives for spring-cloud/spring-cloud

31st
Jul 2018
Thales Sousa
@tminussi
Jul 31 2018 12:45
Hello, code stars! I have worked with Spring Cloud in the past and I am just getting back to it now (I am trying to replace all our current microservices calls to use feign and I also want to drop our existing built-in gateway in favor of Zuul). One of the features available in our gateway which is hard to replace is to change connectors on the fly, meaning that if I go to route X in our gateway, the gateway has a connector which decides where to go next, pretty much what Zuul does with the routes in the .yml file. On our gateway, however, we can change those routes on the fly. Is it possible to do that with Zuul? Only thing I can think would be to use a Config Server, but I think a reboot would stiil be needed because Zuul routes are defined during bootstrap. Am I clear here? Please let me know if you need further info.
Vyom
@vyomrastogi
Jul 31 2018 15:46
I think config
Spencer Gibb
@spencergibb
Jul 31 2018 16:39
@tminussi routes can be refreshed on the fly with the /refresh actuator endpoint. I'd look at spring-cloud-gateway as well
Thales Sousa
@tminussi
Jul 31 2018 17:01
@vyomrastogi @spencergibb thank you both for your willingness to help. @spencergibb would it work though? Because in order to call the /refresh I'd need to have a @RefreshScope bean, which is not the case since Zuul picks up the configurations directly from the .yml on the startup process (it's not like I was using a @Value attribute that could be refreshed using actuator endpoints). spring-cloud-gateway does the job though I think, because I would then be able to refresh the hardcoded values provided to uri and predicate methodsin a @RefreshScope bean.
Spencer Gibb
@spencergibb
Jul 31 2018 17:02
no need for a @RefreshScope bean, since /refresh also rebinds @ConfigurationProperties.
Thales Sousa
@tminussi
Jul 31 2018 17:02
Awesome! Thanks, @spencergibb! I did not know about that :)
Vyom
@vyomrastogi
Jul 31 2018 17:05
Also, by using spring cloud bus and rabbit mq, there won't be any need to call /refresh separately. The /monitor endpoint can take care of listening to any changes (webhooks) in config and then send message to queue.
Sorry for previous message, I was typing something and then got distracted !!!
Thales Sousa
@tminussi
Jul 31 2018 17:19
No problem, @vyomrastogi. Many thakns!