forked from scullxbones/akka-persistence-mongo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix scullxbones#179: ActorRef serialization: transportInformation sho…
…uld be set Signed-off-by: Gaël Bréard <gael.breard@orange.com>
- Loading branch information
Showing
4 changed files
with
52 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
common/src/main/scala/akka/contrib/persistence/mongodb/SerializationHelper.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2018 Gael Breard, Orange: Fix issue #179 about actorRef serialization | ||
*/ | ||
package akka.contrib.persistence.mongodb | ||
|
||
import akka.actor.ExtendedActorSystem | ||
import akka.serialization.Serialization | ||
|
||
object SerializationHelper { | ||
//may be replaced with future API in Serialization : Serialization.withTransportInformation(ser.system) | ||
def withTransportInformation[T](system: ExtendedActorSystem)(f: => T): T = { | ||
val address = system.provider.getDefaultAddress | ||
if (address.hasLocalScope) { | ||
f | ||
} else { | ||
Serialization.currentTransportInformation.withValue(Serialization.Information(address, system)) { | ||
f | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters