Skip to content

Custom Actuator Endpoint with MediaType as text/event-stream is not working #42470

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

Closed
talasila-sairam opened this issue Sep 28, 2024 · 6 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@talasila-sairam
Copy link

Versions That i have used
Java:- OpenJDK-11
Spring boot: 2.7.0
reactor-core: 3.4.28
netty: 1.0.30

Problem: I created a custom actuator endpoint to expose a data stream, however despite events being triggered, requests are taking a long time to complete and no data is being released.

This is my simple controller
image
I noticed that, while the same configuration functions perfectly when using the restController, it does not function when using the endpoint and readOperation annotation.
image

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 28, 2024
@bclozel
Copy link
Member

bclozel commented Sep 28, 2024

Sorry but Spring Boot 2.7.x is out of open source support. We can reopen this issue if you provide a minimal sample that reproduces the problem on a supported version (3.2.x+). See https://spring.io/projects/spring-boot#support

Thanks!

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2024
@bclozel bclozel added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 28, 2024
@talasila-sairam
Copy link
Author

resilience4j-spring-boot3-demo.zip
Hey @bclozel and @wilkinsona
I've attached a zip file including all of my project files. Please let me know if you require anything else.

@wilkinsona
Copy link
Member

Thanks, @talasila-sairam. Unfortunately, there are really too many moving parts in that code for us to start looking at it. As I said on #42475, please reduce it to the bare minimum that's required to reproduce the problem. As I understand the problem, that should be dependencies on only the actuator and webflux starters and a single custom endpoint that uses text/event-stream.

@wilkinsona
Copy link
Member

Actually, on second look, I'm not surprised that this doesn't work. You're using ServerSentEvent that is, quoting from its javadoc, "for use with Spring's reactive Web support". You're not (directly) using Spring's reactive web support here, you're using the Actuator's endpoint infrastructure which is an abstraction on top of Spring MVC, Spring WebFlux, and Jersey. As such, you should not expect features for use with WebFlux to work.

You may be able to use @RestControllerEndpoint instead. This couples your endpoint to Spring MVC or Spring WebFlux. Note that it has been deprecated since Spring Boot 3.3.x as we intend to tighten up Actuator's endpoint infrastructure in Spring Boot 4 and only support higher-level concepts that can be mapped to all three web frameworks that we support.

@talasila-sairam
Copy link
Author

  • Thank you for your response. Is there any way to obtain the events using the actuator endpoint in this scenario?similar to produces for an actuator endpoint should be text/event-stream. is that possible?
  • What is being obsoleted in this instance? I did't get that point.

@wilkinsona
Copy link
Member

Is there any way to obtain the events using the actuator endpoint in this scenario?similar to produces for an actuator endpoint should be text/event-stream

You may be able to use @RestControllerEndpoint as I mentioned above.

What is being obsoleted in this instance? I did't get that point.

Please see #31768.

If you have any further questions, please follow up on Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants