This document describes the current stable version of Kombu (4.0). For development docs, go here.

Message Serialization - kombu

Serialization utilities.

Overview

Centralized support for encoding/decoding of data structures. Contains json, pickle, msgpack, and yaml serializers.

Optionally installs support for YAML if the PyYAML package is installed.

Optionally installs support for msgpack if the msgpack-python package is installed.

Exceptions

exception kombu.serialization.SerializerNotInstalled[source]

Support for the requested serialization type is not installed.

Serialization

kombu.serialization.raw_encode(data)[source]

Special case serializer.

Registry

kombu.serialization.register(self, name, encoder, decoder, content_type, content_encoding=u'utf-8')

Register a new encoder/decoder.

Parameters:
  • name (str) – A convenience name for the serialization method.
  • encoder (callable) – A method that will be passed a python data structure and should return a string representing the serialized data. If None, then only a decoder will be registered. Encoding will not be possible.
  • decoder (Callable) – A method that will be passed a string representing serialized data and should return a python data structure. If None, then only an encoder will be registered. Decoding will not be possible.
  • content_type (str) – The mime-type describing the serialized structure.
  • content_encoding (str) – The content encoding (character set) that the decoder method will be returning. Will usually be utf-8, us-ascii, or binary.
kombu.serialization.registry = <kombu.serialization.SerializerRegistry object>

Global registry of serializers/deserializers.