I get the following log messages every time I send a message to to the 
remote system:

backend [DEBUG] [08/21/2015 23:26:40.513] 
[default-akka.actor.default-dispatcher-23] 
[akka://default/system/IO-TCP/selectors/$a/18] Attempting connection to 
[/127.0.0.1:6666]
backend [DEBUG] [08/21/2015 23:26:40.514] 
[default-akka.actor.default-dispatcher-23] 
[akka://default/system/IO-TCP/selectors/$a/18] Connection established to 
[/127.0.0.1:6666

Does this mean a connection is created every time I try to send something 
or is the connection reused? I would prefer the latter how can I achieve 
that if it is not already the case?

My code looks basically like this:

// I would like to do some caching here
val tcpFlow = Tcp().outgoingConnection(host, port)

// Here, a connection should only be created when none exists
def send() = {
  implicit val m = ActorMaterializer()
  val byteString: IndexedSeq[akka.util.ByteString] = ...
  val resp = Source(byteString).via(tcpFlow).runFold(ByteString.empty)(_++_)
  resp onComplete { ... }
}

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