Hi luben,

You’ve bumped into a bug that came in during M4 when we moved over to
carrying the materialized value for source/sink/flow around in the type.

We already have a ticket about it: https://github.com/akka/akka/issues/17039
and will fix it in the upcoming release (RC1 yay!).
The gist of the issue is that methods should have defined Source[Something,
_] instead of Source[Something, Unit] (as _ desugars to Object).

For the time being you can apply the implicit def that converts
Source[Something,
Unit] to the underscored version via (as shown in the ticket):
​

  implicit def ignoreMaterializedValues[T](self: Source[T, _]):
Source[T, Unit] =
    self.mapMaterialized(_ => ())


Thanks for the ping and sorry for the inconvenience, we'll iron out those
issues and move into ReleaseCandidate mode in which less API changes should
be expected (less, but still some).


On Mon, Mar 30, 2015 at 8:33 PM, Любен Каравелов <[email protected]>
wrote:

> 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.
>



-- 
Cheers,
Konrad 'ktoso' Malawski
Akka <http://akka.io/> @ Typesafe <http://typesafe.com/>

-- 
>>>>>>>>>>      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.

Reply via email to