Quarkus - реактивная загрузка файлов - PullRequest
0 голосов
/ 18 марта 2020

Используя Quarkus , кто-нибудь может привести пример того, как код на стороне сервера и клиента использует реактивный API для загрузки файла через http?

До сих пор я пытался вернуть Flux из nio ByteBuffers, но, похоже, он не поддерживается:

@RegisterRestClient(baseUri = "http://some-page.com")
interface SomeService {

    // same interface for client and server
    @GET
    @Produces(MediaType.APPLICATION_OCTET_STREAM)
    @Path("/somePath")
    fun downloadFile(): reactor.core.publisher.Flux<java.nio.ByteBuffer>
}

Попытка вернуть Flux на стороне сервера приводит к следующему исключению:

ERROR: RESTEASY002005: Failed executing GET /somePath
org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: kotlinx.coroutines.reactor.FlowAsFlux of media type: application/octet-stream
    at org.jboss.resteasy.core.ServerResponseWriter.lambda$writeNomapResponse$3(ServerResponseWriter.java:124)
    at org.jboss.resteasy.core.interception.jaxrs.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:403)
    at org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:251)
    ...
...