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

19th
Jun 2018
Haruhiko Nishi
@hanishi
Jun 19 2018 05:28
Hi, what are the cases when all instances subscribed to Spring Event Bus respond to refresh event regardless of the destination parameter specified?
I am trying to refresh only specific instances matching a specified path. But the destination parameter is ignored and all instances are refreshed. The/traceresults even show that destination was set to "**:**"
This is what get logged when instances are refreshed.
2018-06-19 14:19:40.142  INFO [euler-httpclient-processor-kafka,04772d505166a729,04772d505166a729,false] 18805 --- [o-auto-1-exec-8] s.c.a.AnnotationConfigApplicationContext : Refreshing 
...
Haruhiko Nishi
@hanishi
Jun 19 2018 06:07

destination was set to "**:**"

correction "destination": "*:**", only one asterisk

Haruhiko Nishi
@hanishi
Jun 19 2018 06:14
This is how request is made
[admin@adpt3 streaming]$ curl -v --noproxy localhost -X POST http://adpt3.euler:40090/management/bus/refresh?destination=foo:**
* About to connect() to adpt3.euler port 40090 (#0)
*   Trying 10.203.0.10...
* Connected to adpt3.euler (10.203.0.10) port 40090 (#0)
> POST /management/bus/refresh?destination=foo:** HTTP/1.1
> User-Agent: curl/7.29.0
> Host: adpt3.euler:40090
> Accept: */*
>
< HTTP/1.1 200
< X-Application-Context: euler-httpclient-processor-kafka:aggregator,euler-s3:0
< Content-Length: 0
< Date: Tue, 19 Jun 2018 06:13:22 GMT
<
* Connection #0 to host adpt3.euler left intact
Haruhiko Nishi
@hanishi
Jun 19 2018 06:30

OK I think I know what I have misunderstood.

If refreshrequest is directly targeted the instance and it is refresh capable, then it refreshes regardless of destination parameter. If refresh is received by an instance and is propagated to other instances subscribing to the Spring Cloud Bus, then the destination is checked against. (destination is used) Am I correct?

Haruhiko Nishi
@hanishi
Jun 19 2018 06:51
I mean the destination is checked by the instances received request via bus.
Haruhiko Nishi
@hanishi
Jun 19 2018 07:00
If you have two instance of same app each launched with different profiles('a', and 'b') and both are clients to Eureka and both are registered under a name "service", then if your FeinClient happen to pick 'a' and your destination parameter is set to a path that includes 'b' in it, then this will trigger refresh of instance 'a' regardlessly, which is no what is expected.
CH4:D
@chad_d_stud_twitter
Jun 19 2018 07:01
has anyone tried using nginx as an api gateway?
instead of the usual spring api gateway
Haruhiko Nishi
@hanishi
Jun 19 2018 07:22

If you have two instance of same app each launched with different profiles('a', and 'b') and both are clients to Eureka and both are registered under a name "service", then if your FeinClient happen to pick 'a' and your destination parameter is set to a path that includes 'b' in it, then this will trigger refresh of instance 'a' regardlessly, which is no what is expected.

I think I got confused, but this is actually what is expected and correct.

玹霖
@SoftwareKing
Jun 19 2018 07:56
When is it announce the Spring Cloud Finchley Release ? @spencergibb @marcosbarbero
Marcos Barbero
@marcosbarbero
Jun 19 2018 08:00
There was an issue with sonatype blocking the release, once it's solved it will be released at any moment @SoftwareKing
Haruhiko Nishi
@hanishi
Jun 19 2018 11:46
I think my RestTemplate is failing to POST the trailing request parameter,"/bus/refresh?destination=<appname>:**" thusly all of the instances subscribed to Spring Cloud Bus reacts to this requests and refresh themselves. Do I need to include it as part of url?
Marcos Barbero
@marcosbarbero
Jun 19 2018 11:56
Yeah, it’s happening @breun
Elena Neroslavskaya
@lenisha
Jun 19 2018 12:07
U
What is the best way when using Spring Cloud Connectors to add custom code to the Sql connection? Some sort of connection customizer?
Marcos Barbero
@marcosbarbero
Jun 19 2018 12:12
which connector are you using? just the core one? @lenisha
Haruhiko Nishi
@hanishi
Jun 19 2018 12:24

I think my RestTemplate is failing to POST the trailing request parameter,"/bus/refresh?destination=<appname>:**" thusly all of the instances subscribed to Spring Cloud Bus reacts to this requests and refresh themselves. Do I need to include it as part of url?

I think it there is some other problem I cannot identify. All I know is destinaiton param is disregarded totally... it worked with curl command

Marcos Barbero
@marcosbarbero
Jun 19 2018 12:31
Let me ask you something, why are you using RestTemplate to send a request to trigger the /bus/refresh?
Haruhiko Nishi
@hanishi
Jun 19 2018 12:37
Because FeinClient didn’t work so I switched to RestTemplate with LoadBalancer
Is there a proper way to send refresh requests to Eureka clients?
Marcos Barbero
@marcosbarbero
Jun 19 2018 12:43
I'm still not following the reason to request this specific endpoint either by RestTemplate or Feign, can't you rely on spring-cloud-config-monitor and the push notifications?
Haruhiko Nishi
@hanishi
Jun 19 2018 12:50
We forcefully make Property beans’s afterPropertiesSet invoked wherein data is loaded from RDBMS using SQL and creates its internal cache for later use.
So it’s not when configuration changes when we need the refresh to happen but when the table entries change.
I know it is really bad design and I myself didn’t agree with this but I sometimes need to deal with legacy part of system that’s badly designed.
Marcos Barbero
@marcosbarbero
Jun 19 2018 12:56
how do you know about the table entries updates?
Haruhiko Nishi
@hanishi
Jun 19 2018 12:58
We’ll,whenever user performs operations that updates relevant table that’s when the refresh is performed
Marcos Barbero
@marcosbarbero
Jun 19 2018 12:59
how does your application nows about it to trigger this RestTemplate? Is it a manual step?
Haruhiko Nishi
@hanishi
Jun 19 2018 13:05
It’s accessed from UI service so no different from calling Web APIs
Marcos Barbero
@marcosbarbero
Jun 19 2018 13:06
do you have some code to share? like your restTemplate call
Haruhiko Nishi
@hanishi
Jun 19 2018 13:06
It’s like instantly changing routine table which is very close to what we do
I left my office already and I don’t have access to my code now, but basically what I did is including the param part with the value URL encoded as part of URI. Does it supposed to drop the param part if request is created?
Haruhiko Nishi
@hanishi
Jun 19 2018 13:12
I also tried putting as MultiValueMap but this didn’t seem to work either
Marcos Barbero
@marcosbarbero
Jun 19 2018 13:15
you should to something like this
Haruhiko Nishi
@hanishi
Jun 19 2018 13:23
Thanks for reminding the UriComponentsBuilder I think I remember seeing it when I was working with SpringSocial I’ll try that. I was thinking it’s some Kafka issue that I can’t get it through.
Marcos Barbero
@marcosbarbero
Jun 19 2018 13:28
let me know if it works
Haruhiko Nishi
@hanishi
Jun 19 2018 14:00
@marcosbarbero
Thank you! I will.
Fethullah Misir
@fmisir
Jun 19 2018 14:14

Hi all, i upgraded from spring cloud connectors 2.0.1.RELEASE to 2.0.2.RELEASE and got login failures with a oracle database.
The problem is that in 2.0.2 the password and username is URL Encoded, thus the login fails when the password/username contains special characters like for my case a bracket ']'.

The encoding is done only for Oracle.
https://github.com/spring-cloud/spring-cloud-connectors/blob/2.0.2.RELEASE/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/OracleServiceInfo.java
https://github.com/spring-cloud/spring-cloud-connectors/blob/2.0.1.RELEASE/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/OracleServiceInfo.java

Is there any reason why username and password are going to be url encoded for building the JDBC URL? And is there a workaround for this "issue"? Thx!

Elena Neroslavskaya
@lenisha
Jun 19 2018 14:18
@marcosbarbero using core cloud connector and cloudfoundry
alfsender
@alfsender
Jun 19 2018 15:15
Hi All, I have small spring-boot application (using 2.0.0.RELEASE). I want to convert this to a AWS Lambda function..
I created a lambda function by implementing com.amazonaws.services.lambda.runtime.RequestHandler, but I am not sure how do i initialize spring boot app, so all my services gets injected to this Handler..
Marcos Barbero
@marcosbarbero
Jun 19 2018 16:59
What exactly you wanna do @lenisha? You can customize the datasource for cloud foundry