Skip to content
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

Simplify DgsSSESubscriptionHandler by returning Flux #1001

Merged
merged 1 commit into from Apr 22, 2022

Commits on Apr 22, 2022

  1. Simplify DgsSSESubscriptionHandler by returning Flux

    DgsSSESubscriptionHandler was rolling its own Subscriber implementation in order
    to adapt the Publisher returned by the GraphQL query to the SseEmitter; however,
    Spring itself will handle this when the content type is "text/event-stream" and
    we simply return a reactive type, such as Flux. Doing so greatly simplifies the
    code in the controller, and allows for future enhancements such as propagating
    context to the publisher.
    
    Another change is that any error condition occurring before the GraphQL query is
    executed successfully (e.g., a Publisher is returned) will result in a non-SSE response;
    that is, the status code of the response will be non-200, and the error message
    will no longer be written as a single server-sent event.
    
    Finally, the way errors are written has been fixed. Previously the entire stack trace
    was accidentally written to the event, now only the exception message is propagated.
    kilink committed Apr 22, 2022
    Configuration menu
    Copy the full SHA
    d9d115d View commit details
    Browse the repository at this point in the history