Class 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 configuration jackson-modules.

    It will compress the payload if the compression algorithm is enabled and the the payload is larger than the configured compress-larger-than value.

    • 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)
      • bindingName

        public java.lang.String bindingName()
      • objectMapper

        public com.fasterxml.jackson.databind.ObjectMapper objectMapper()
      • 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 class SerializerWithStringManifest
        Parameters:
        obj - (undocumented)
        Returns:
        (undocumented)
      • 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 in fromBinary 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 class SerializerWithStringManifest
        Parameters:
        bytes - (undocumented)
        manifest - (undocumented)
        Returns:
        (undocumented)
      • compress

        public byte[] compress​(byte[] bytes)
      • decompress

        public byte[] decompress​(byte[] bytes)