In akka-http, HttpRequest and HttpResponse are mostly immutable objects, except for their HttpEntity bodies (which have a Source).
Is it safe to send a request, response, or solo entity to another actor (especially a remote actor) or is some precaution needed?
As stated in the comments: sending an
HttpEntityto a remoteActoris unlikely to work due to the socket limitation. Further evidence can be found in the documentation (emphasis theirs):However, the
ByteStringvalues coming from theSourcedo not have the same limitations as the Source itself since ByteString is immutable. You could simply drain the Source on the localakka-httpActorSystem and dispatchByteStringvalues to your remote Actor.As an example, say you want to use an Actor to uppercase all of the characters in a utf-8 based HttpEntity. You can setup your Actor:
Then your akka-http could look like: