Open naivefun opened 7 years ago
Certainly, other implementations will be created. I plan on using spring-data repositories. Since the api is non-blocking, repositories like casandra, redis, mongo and couchbase will fit easier. JDBC will need more work.
Spring Data JPA is using @Async
to offer non-blocking API so maybe that's not a bad idea for now.
JDBC is, by definition, blocking. @Async
only moves execution to a thread pool.
Indeed. Is there any other way to enable non-blocking for JDBC?
@naivefun nope.
whenever we update the routes, we have to restart the gateway server. How can we update the routes dynamically ? is there any way to fetch the routes through jdbc?
You can publish a new RefreshRoutesEvent() so that its reloaded without a restart.
@ghoddg or post to /actuator/gateway/refresh
.
Thanks Spencer, Do you have the reference implementation project on github with JDBC routes repository?
As long as this issue is open, there is not one.
@ghoddg not in an unrelated issue. Please ask on stack overflow or gitter.
Hello @spencergibb ..can you help me understand on your above comment "or post to /actuator/gateway/refresh"
I have implemented my Config Server with JDBC backend and not GIT. Now, i am thinking how can I use my config server to dynamically update the routes defined in application.yaml
@ghoddg do you have any work around yet?
Hi @Emmarock we can add the routes in PROPERTIES table of config server and make the gateway as client of config server. Make sure config server should start before the gateway, so when you start gateway, it will load the configuration from config server.
Sample config script for one of service islike below, Insert into PROPERTIES (ID,APPLICATION,PROFILE,LABEL,KEY,VALUE) values (1,'api-gateway','jdbc','jdbc','zuul.routes.api.path','/api/**'); Insert into PROPERTIES (ID,APPLICATION,PROFILE,LABEL,KEY,VALUE) values (2,'api-gateway','jdbc','jdbc','zuul.routes.api.serviceId','ACCOUNT-SERVICE'); Insert into PROPERTIES (ID,APPLICATION,PROFILE,LABEL,KEY,VALUE) values (3,'api-gateway','jdbc','jdbc','zuul.routes.api.stripPrefix','true');
@spencergibb When does this function be provided?
@spencergibb ,How to implement dynamic routing? When will this be solved?It's been a long time
Nothing has changed.
As long as this issue is open, there is not one.
Which spring cloud gateway version is planned to support? @spencergibb
It is not planned
And probably won't be until there is a reactive jdbc solution for spring.
I'm new to Spring cloud gateway and reactivate programming. As per my understanding, routes will get loaded into heap during the server startup or whatever we call refresh API(actuator). Blocking vs Non blocking JDBC driver(reactivate), does it have huge impact on performance if we use regular JDBC driver or am I missing something? @spencergibb
what about spring data r2dbc?
yup, r2dbc would be what we use for reactive gateway server
Hi, Am not sure if this is relevant to the discussion above, but am using JDBC backend to store my Spring Gateway routes and have defined as in the screenshot attached
I added routes to my MySQL table and called the [POST] Gateway-Service/actuator/refresh
API to refresh the config, and the new routes were added automatically during runtime without the need for a Gateway-service restart
Seems there is only memory based implementation now, would be great if it supports persistable repository.