Class JacksonSerializer
- java.lang.Object
-
- akka.serialization.SerializerWithStringManifest
-
- akka.serialization.jackson.JacksonSerializer
-
- All Implemented Interfaces:
Serializer
- Direct Known Subclasses:
JacksonCborSerializer
,JacksonJsonSerializer
public abstract class JacksonSerializer extends SerializerWithStringManifest
INTERNAL API: Base class for Jackson serializers.Configuration in
akka.serialization.jackson
section. It will load Jackson modules defined in configurationjackson-modules
.It will compress the payload if the compression
algorithm
is enabled and the the payload is larger than the configuredcompress-larger-than
value.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JacksonSerializer.GadgetClassDenyList
Using the deny list from Jackson databind of class names that shouldn't be allowed.static class
JacksonSerializer.LZ4Meta
static class
JacksonSerializer.LZ4Meta$
-
Constructor Summary
Constructors Constructor Description JacksonSerializer(ExtendedActorSystem system, java.lang.String bindingName, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
bindingName()
byte[]
compress(byte[] bytes)
byte[]
decompress(byte[] bytes)
static scala.collection.immutable.Set<java.lang.Class<?>>
disallowedSerializationBindings()
java.lang.Object
fromBinary(byte[] bytes, java.lang.String manifest)
Produces an object from an array of bytes, with an optional type-hint.int
identifier()
Completely unique value to identify this implementation of Serializer, used to optimize network traffic.static boolean
isGZipped(byte[] bytes)
static boolean
isLZ4(byte[] bytes)
java.lang.String
manifest(java.lang.Object obj)
Return the manifest (type hint) that will be provided in the fromBinary method.com.fasterxml.jackson.databind.ObjectMapper
objectMapper()
ExtendedActorSystem
system()
byte[]
toBinary(java.lang.Object obj)
Serializes the given object into an Array of Byte.-
Methods inherited from class akka.serialization.SerializerWithStringManifest
fromBinary, includeManifest
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.serialization.Serializer
fromBinary, fromBinary
-
-
-
-
Constructor Detail
-
JacksonSerializer
public JacksonSerializer(ExtendedActorSystem system, java.lang.String bindingName, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Detail
-
disallowedSerializationBindings
public static scala.collection.immutable.Set<java.lang.Class<?>> disallowedSerializationBindings()
-
isGZipped
public static boolean isGZipped(byte[] bytes)
-
isLZ4
public static boolean isLZ4(byte[] bytes)
-
system
public ExtendedActorSystem system()
-
bindingName
public java.lang.String bindingName()
-
objectMapper
public com.fasterxml.jackson.databind.ObjectMapper objectMapper()
-
identifier
public int identifier()
Description copied from class:SerializerWithStringManifest
Completely unique value to identify this implementation of Serializer, used to optimize network traffic. Values from 0 to 40 are reserved for Akka internal usage.- Specified by:
identifier
in interfaceSerializer
- Specified by:
identifier
in classSerializerWithStringManifest
-
manifest
public java.lang.String manifest(java.lang.Object obj)
Description copied from class:SerializerWithStringManifest
Return the manifest (type hint) that will be provided in the fromBinary method. Use""
if manifest is not needed.- Specified by:
manifest
in classSerializerWithStringManifest
-
toBinary
public byte[] toBinary(java.lang.Object obj)
Description copied from class:SerializerWithStringManifest
Serializes the given object into an Array of Byte.Note that the array must not be mutated by the serializer after it has been returned.
- Specified by:
toBinary
in interfaceSerializer
- Specified by:
toBinary
in classSerializerWithStringManifest
-
fromBinary
public java.lang.Object fromBinary(byte[] bytes, java.lang.String manifest)
Description copied from class:SerializerWithStringManifest
Produces an object from an array of bytes, with an optional type-hint.It's recommended to throw
java.io.NotSerializableException
infromBinary
if the manifest is unknown. This makes it possible to introduce new message types and send them to nodes that don't know about them. This is typically needed when performing rolling upgrades, i.e. running a cluster with mixed versions for while.NotSerializableException
is treated as a transient problem in the TCP based remoting layer. The problem will be logged and message is dropped. Other exceptions will tear down the TCP connection because it can be an indication of corrupt bytes from the underlying transport.- Specified by:
fromBinary
in classSerializerWithStringManifest
-
compress
public byte[] compress(byte[] bytes)
-
decompress
public byte[] decompress(byte[] bytes)
-
-