-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
health actuator for solace binder #55
health actuator for solace binder #55
Conversation
@Mrc0113 any updates here? How we can make progress? |
Hi @GreenRover, thanks for pinging me on this. I love what you have done and agree we should enable the ability to get the status of binders via actuator. Here are my thoughts on the details:
|
Hi @Mrc0113 any updates on this issue? Any feedback from your team? Automated testing could be hard at this point. Especially we only serve a spring boot api that do the real job. |
Hi @Mrc0113 any updates on this issue? Any feedback from your team? |
@@ -50,6 +50,11 @@ | |||
<artifactId>spring-cloud-stream</artifactId> | |||
</dependency> | |||
|
|||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-actuator</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The artifact ID must be spring-boot-starter-actuator
. Also make this an optional dependency.
@@ -27,15 +30,18 @@ | |||
|
|||
private JCSMPSession jcsmpSession; | |||
|
|||
private SolaceHealthIndicator solaceHealthIndicator = new SolaceHealthIndicator(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Including the SessionEventHandler
into the session needs to be reworked to handle actuator being an optional dependency, where the actuator classes might not be present on the class path.
An idea on how you could achieve this:
@Import
theSolaceHealthIndicatorConfiguration
toSolaceMessageChannelBinderConfiguration
.- Split the
SessionEventHandler
fromSolaceHealthIndicator
and make it its own bean. Where theSolaceHealthIndicator
bean would depend on theSessionEventHandler
bean. @Autowired(required = false)
theSessionEventHandler
here and use it when creating theJCSMPSession
.
protected void doHealthCheck(Health.Builder builder) throws Exception { | ||
if(connected.get()) { | ||
builder.up(); | ||
} else { | ||
builder.down(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If the
SessionEventArgs
has a non-nullgetException()
, set it as an exception on theHeath.Builder
. - If the
SessionEventArgs
has a non-zerogetResponseCode()
, set it as a detail on theHeath.Builder
. - If the
SessionEventArgs
has a non-nullgetInfo()
, set it as a detail on theHeath.Builder
.
@GreenRover Thank you for the opening this pull request. We've added support for the health actuator in #125 to be released in the Closing this pull request as a duplicate of #125. |
Spring cloud stream - spring health integration
Scenario starting up
Try starting the application once with only main_session in application.yaml.
To do that remove all other sessions, except main_session part and specify main_session on second binder.
The application should start up without problem. Health page goes up.
Then do it again with a binder which has a connection but no working credentials. The application will not come up crash and health page is never on "up".
Scenario user enabled changed / deleted while running
Use i.e. third session and create a user and put its credentials into that session.
Start application, it should come up normally. The health page shows "up".
If the health indicator is implemented, that health page is showing more information about the sessions:
http://localhost:9003/actuator/health
shows:Delete the user via solace management or deactivate it. As a result solace stops the connection and jcsmp tries to reconnect.
After the reconnection failed after several retries, the binder stops working entirely. But still the health page shows up.
You get a log error message like that: "403: Client Username Is Shutdown".
The binder is not able to recover from this situation.
Recreate the user or activate it again - the session remains closed and you get the same error message again.
With fixed health page the health page is down as a result like this:
Note: in this scenario only one of the session components is down, third_session.
Scenario broker gets down for a time
The reconnect duration is taking a lot of time but eventually you get "Connection timed out: no further information"
and the health goes to down:
Note: in this scenario all sessions are down.
Usage of the health indicator
Those health indicator can be used by kubernetes to kill / restart the pod/application if there is no connection to broker any more (and will not recover).
In this case we can leave the error reporting / disaster handling to kubernetes.