Reputation: 95
I'm using remote akka actors and I want to send serialized messages, use ObjectOutputStream but have abd error when the local actor send the messages to remote actor, the error is: java.io.NotRerializableException no configured serialization - bindings for class java.io.ObjectOutputStream which type of serialization is recommended?
Upvotes: 0
Views: 603
Reputation: 11741
You don't have to create your own ObjectOutputStream
to send the message. You just a domain message object (e.g., Person
, AddItem
, ...) that is serializable to your Akka actors. Akka will take care of sending it over the wire. By default it will use Java serialization (which is not the most efficient).
Upvotes: 1
Reputation: 7247
A java.io.ObjectOutputStream
is not serializable so it can't be sent as a remote message out-of-the-box. You'll either need to send a different message or write a serializer for that class and configure Akka appropriately. But, given what an ObjectOutputStream
is, it doesn't even make sense for an object of that type to be sent over the wire.
Moreover, java.io.ObjectOutputStream
is effectively mutable and so it absolutely should not be sent as a message in Akka anyways, rendering this whole thing moot. Just don't do it.
Upvotes: 2