Hi,
I have built a small HTTP EventSource endpoint prototype based on
akka-streams-1.0-M3 for a system that I am working on. It turned quite
well. I have tried to upgrade it to 1.0-M5 and I can't figure out how to
create HttpEntity out of an ActorPublisher.
In short, I have ActorPublisher that produces a stream of events serialized
as ByteString:
class StreamSource(query: String) extends ActorPublisher[ByteString] ...
I am creating the Source from the companion object:
object StreamSource {
def apply(query: String) =
Source[ByteString](Props(classOf[StreamSource], query))
}
In 1.0-M3 I was able to create a HttpEntity for the Response with:
HttpEntity.CloseDelimited(mediaType, StreamSource(query))
But it breaks with 1.0-M5: the Source.apply[T]( props: Props) constructor
creates Source[T, ActorRef] but all the HttpEntity constructors accept only
Source[T,Unit]. The exact error is:
[error] found :
akka.stream.scaladsl.Source[akka.util.ByteString,akka.actor.ActorRef]
[error] required: akka.stream.scaladsl.Source[akka.util.ByteString,Unit]
[error] HttpResponse(200, entity =
HttpEntity.CloseDelimited(mediaType, StreamSource(query)), headers =
List(cors))
I have browsed the documentation and the sources for a few hours without
finding a solution. So what is the currently supported way of creating
HttpEntity instances with ActorPublisher source ?
Thanks in advance for any pointers,
luben
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.