In the yaml, if rsocket.brokers is list, `RSocketBrokerHealthIndicator` is not registered.
amondnet opened this issue · comments
Describe the bug
In the yaml, if rsocket.brokers
is a list, then RSocketBrokerHealthIndicator
is not registered.
rsocket:
brokers:
- tcp://localhost:9999
If it is a string, then RSocketBrokerHealthIndicator
is registered.
rsocket:
brokers: tcp://localhost:9999
Environment
- Alibaba RSocket Broker version: 1.1.5
- Operating System version: Mac
- Java version: 17
Steps to reproduce this issue
- set rsocket.brokers to list
rsocket: brokers: - tcp://localhost:9999 management: endpoint: health: show-details: always
- bootRun
- open
http://localhost:8080/actuator/health
Pls. provide GitHub address to reproduce this issue.
Expected Result
{
"status": "DOWN",
"components": {
"mongo": {
"status": "UP",
"details": {
"maxWireVersion": 17
}
},
"ping": {
"status": "UP"
},
"r2dbc": {
"status": "UP",
"details": {
"database": "MariaDB",
"validationQuery": "validate(REMOTE)"
}
},
"rsocketBrokerHealth": {
"status": "DOWN",
"details": {
"brokers": "tcp://localhost:9999"
}
}
}
}
Actual Result
{
"status": "UP",
"components": {
"mongo": {
"status": "UP",
"details": {
"maxWireVersion": 17
}
},
"ping": {
"status": "UP"
},
"r2dbc": {
"status": "UP",
"details": {
"database": "MariaDB",
"validationQuery": "validate(REMOTE)"
}
}
}
}
rsocket.broker.topology=gossip
rsocket.broker.seeds=192.168.1.2,192.168.1.3,192.168.1.4
rsocket.broker.topology=gossip
rsocket.broker.seeds=192.168.1.2,192.168.1.3,192.168.1.4
The above properties are used by the alibaba-rsocket-server
. This issue occurs in alibaba-rsocket-spring-boot-starter.
.
@Bean
@ConditionalOnProperty("rsocket.brokers")
public RSocketBrokerHealthIndicator rsocketBrokerHealth(RSocketEndpoint rsocketEndpoint, UpstreamManager upstreamManager, @Value("${rsocket.brokers}") String brokers) {
return new RSocketBrokerHealthIndicator(rsocketEndpoint, upstreamManager, brokers);
}
If you use application.properties
or application.yaml
+ string, the RSocketBrokerHealthIndicator
will be registered without any problems.
rsocket.brokers=tcp://localhost:9999
rsocket:
brokers: tcp://localhost:9999
However, if you use an array of strings, it won't register.
rsocket:
brokers:
- tcp://localhost:9999
This is fine for practical use, but kubernetes scheduler can't perform health checks properly because the health indicator is not registered.
Sorry for last reply. But it works for me.
Envirements:
- SpringBoot 3.1.4
- Alibaba RSocket Broker version: 1.1.5
- Operating System version: Mac
- Java version: 17
Code:
rsocket:
brokers:
- tcp://127.0.0.1:9999
- tcp://127.0.0.1:9999
jwt-token: None
Array indentation should be 2 space in your yaml file.
I've been using alibaba-rsocket-broker
in production for over a year. I'm not talking about the rsocket app not working, I'm talking about the health indicator not registering.
In the yaml, if rsocket.brokers is a list, then RSocketBrokerHealthIndicator is not registered.
- use string
rsocket:
brokers: tcp://127.0.0.1:9999
jwt-token: None
management:
endpoint:
health:
show-details: always
curl http://localhost:8080/actuator/health/rsocketBrokerHealth
{"status":"UP","details":{"brokers":"tcp://127.0.0.1:9999","localServiceStatus":"Serving"}}
- use array
rsocket:
brokers:
- tcp://127.0.0.1:9999
jwt-token: None
management:
endpoint:
health:
show-details: always
curl http://localhost:8080/actuator/health/rsocketBrokerHealth
-->
You are right, there's a bug in the method rsocketBrokerHealth of class com.alibaba.spring.boot.rsocket.RSocketAutoConfiguration.
CODE:
@Bean
@ConditionalOnProperty("rsocket.brokers")
public RSocketBrokerHealthIndicator rsocketBrokerHealth(
RSocketEndpoint rsocketEndpoint,
UpstreamManager upstreamManager,
@Value("${rsocket.brokers}") String brokers
) {
return new RSocketBrokerHealthIndicator(rsocketEndpoint, upstreamManager, brokers);
}