@Override
    public HttpResponse convertResponse(ServiceRequestContext ctx,
                                        ResponseHeaders headers,
                                        @Nullable Object result,
                                        HttpHeaders trailers) throws Exception {
        final MediaType contentType = headers.contentType();
        if (contentType != null && contentType.is(MediaType.EVENT_STREAM)) {
            if (result instanceof Publisher) {
                return fromPublisher(headers, (Publisher<?>) result, trailers,
                                     ServerSentEventResponseConverterFunction::toSse);
            }
            if (result instanceof Stream) {
                return fromStream(headers, (Stream<?>) result, trailers, ctx.blockingTaskExecutor(),
                                  ServerSentEventResponseConverterFunction::toSse);
            }
            return fromEvent(headers, toSse(result), trailers);
        }

        if (result instanceof ServerSentEvent) {
            return fromEvent(headers, (ServerSentEvent) result, trailers);
        }

        return ResponseConverterFunction.fallthrough();
    }
A response converter implementation which creates an {@link HttpResponse} with
{@code content-type: text/event-stream}. The objects published from a {@link Publisher} or {@link Stream}
would be converted into Server-Sent Events if a {@link ProducesEventStream} annotation is specified
on an annotated service method.
core/src/main/java/com/linecorp/armeria/server/annotation/ServerSentEventResponseConverterFunction.java