This turned out to be user error. My stream was indirectly being referenced 
via the overriden router function in a Play application ApplicationLoader 
class. Because the router function was being called multiple times, the run 
method on the RunnableGraph was being called multiple times and creating 
multple source actors.

On Thursday, January 28, 2016 at 4:42:33 PM UTC-8, gavares wrote:
>
> I'm attempting to create an actor that extends ActorPublisher and then 
> create a Runnable graph from the following code:
>
> lazy val eventSource: Source[MyEvent, ActorRef] = {
>   logger.debug("Creating BasicSimulator.eventSource")
>   Source.actorPublisher[MyEvent](Props(classOf[BasicSimulatorActor], cfg))
> }
>
> lazy val sinkActor = 
> actorSystem.actorOf(MyActor.props(MyAggregate.createActor), MyActor.Path)
>
>
>
> lazy val runnableGraph: RunnableGraph[ActorRef] = {
>   logger.debug("Creating eventStream RunnableGraph")
>
>   val evtSrc = eventSource
>   val evtSink = Sink.actorRef[MyEvent](sinkActor, StreamClosed)
>   evtSrc.to(evtSink)
> }
>
> runnableGraph.run()
>
>
>
> The problem I'm having is that multiple instances of the source actor are 
> being created. I can see that the logging lines in the code above are each 
> only being printed a single time when the program starts and yet there are 
> two instances of my actor that receive and handle Request messages for the 
> stream and they are named flow-0-0-actorPublisherSource and 
> flow-1-0-actorPublisherSource
>
> Is this expected or am I misunderstanding/misusing the library in some way?
>
>
>

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to