java - Akka Remote and interception of unknown classes through custom deserialization -


problem/context. need send messages remote actor. these messages may contain objects of class unknown on recipient side. , need intercept such situation in order avoid classnotfoundexception.

one solution may consist in intercepting unknown classes @ time of message deserialization. then, message may replaced different application-level message remote actor can communicate sender doesn't have required classes.

i don't know if such interception possible, because custom de/serializators must implement akka.serialization.serializer has following method

def frombinary(bytes: array[byte],                clazz: option[class[_]]): anyref 

now, problem stems construction of class objects (which done akka) objects of unknown class.

is there way customize akka deserialization @ lower-level point in order accomodate needs?

other solutions.

  • the problem similar 1 depicted in following question, different solution has been proposed: deserialize remote object narrowest accessible class still useful have answer there. however, solution wouldn't sufficient me, because while ok restrict interface, still need class implementation methods.

fact 1. discovered there alternative deserialization class type hint, namely deserialization string manifest. reference: http://doc.akka.io/docs/akka/2.4.0/scala/serialization.html#serializer_with_string_manifest

note: not available akka < 2.4.0. might matter akka 2.4.0 support java 1.6/1.7 dropped. means use akka 2.4 required have java 8.

fact 2. discovered akka not provide type hint. can disable type hint in following way

class myownserializer extends akka.serialization.serializer {    override def includemanifest: boolean = false // !!! 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -