The "old way" is still working, so I can fix my problem like that :
val actorRef = system.actorOf(Props[TweetPublisher])
val pub = ActorPublisher[TweetInfo](actorRef)
val source = Source(pub)
Le mercredi 17 juin 2015 14:24:55 UTC+2, Loïc Descotte a écrit :
>
> Hi,
>
> I have an ActorPublisher and I'm building a source from it :
>
> val source = Source.actorPublisher[TweetInfo](Props[TweetPublisher])
>
> I need to send new elements into this source dynamically so I want an
> actor ref.
> On the last documentation (1.0-RC3), I've seen that I can do it this way :
>
> val actorRef = Flow[TweetInfo].to(Sink.ignore).runWith(source)
>
> Then I push dynamically new elements like this (I'm using twitter4J to get
> tweets in live) :
>
> def onStatus(status: TwitterStatus) = {
> //push elements into the source
> actorRef ! TweetInfo(searchQuery, status.getText, status.getUser.
> getName)
> }
>
>
> So it seems that I need to provide a Sink to have an actorRef, so the
> elements in my source are consumed directly.
> That's a problem for me, because I need to keep the elements in the
> source, to process the source later (I will eventually merge it with other
> sources), and when I'm doing this, the source is empty.
>
> Is there a way to have an actorRef from a source without consuming
> elements? Or a way to transfer this elements in another source?
>
> Thanks :)
>
> Loïc
>
>
>
>
>
--
>>>>>>>>>> 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.