Reactive Binary HTTP upload combined with Reactive Mailer #22057
-
Hi, I was experimenting a bit with the reactive REST endpoints from quarkus in combination with Reactive mailer to create a small app which basically receives an image and sends this image in an email. However, for some reason, if I include the attachment, or try to read from the reactive stream, this fails. My code so far below (the relevant parts). The two commented out parts were a test to check if I can just read the whole request stream. This also seems to fail (take indefinitely). Sending the mail without the attachment works just fine. I've tried to search the docs for any info on how to do this, but most of the docs are about returning a reactive response, not reading the request in a reactive way. (btw, first experiment with the reactive API, so bear with me if I'm doing stuff really wrong :) ) val request = HttpServerRequest(re.request())
val attachment = request.toMulti().map {
it.bytes
}.flatMap {
Multi.createFrom().iterable(it.asIterable())
}
// val temp = request.toMulti().subscribe().asStream().collect(Collectors.toList())
// val byteArray = attachment.subscribe().asStream().collect(Collectors.toList()).toByteArray()
val mail = Mail
.withHtml(recipient(), SUBJECT, messageBody())
.addReplyTo(sendingUser())
.addAttachment("receipt", attachment, contentType)
return mailer.send(mail).map { "" } |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Are you using a reactive route or RESTEasy Reactive? |
Beta Was this translation helpful? Give feedback.
Are you using a reactive route or RESTEasy Reactive?