Module: ActiveJob::Temporal::PayloadSerializers

Defined in:
lib/activejob/temporal/payload_serializers.rb,
lib/activejob/temporal/payload_serializers/json.rb,
lib/activejob/temporal/payload_serializers/marshal.rb,
lib/activejob/temporal/payload_serializers/message_pack.rb

Defined Under Namespace

Modules: Json, Marshal, MessagePack

Constant Summary collapse

ENVELOPE_VERSION =
1
JSON =
:json
MESSAGE_PACK =
:message_pack
MESSAGE_PACK_ALIAS =
:msgpack
MARSHAL =
:marshal
SUPPORTED =
[JSON, MESSAGE_PACK, MESSAGE_PACK_ALIAS, MARSHAL].freeze
DATA_ONLY =

Serializers that cannot instantiate arbitrary objects, so a payload may select them even when the configuration names a different serializer.

[JSON, MESSAGE_PACK].freeze

Class Method Summary collapse

Class Method Details

.fetch(name) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/activejob/temporal/payload_serializers.rb', line 22

def fetch(name)
  case normalize_name(name)
  when JSON then PayloadSerializers::Json
  when MESSAGE_PACK then PayloadSerializers::MessagePack
  when MARSHAL then PayloadSerializers::Marshal
  else
    raise ConfigurationError, "Unsupported payload serializer: #{name.inspect}"
  end
end

.normalize_name(name) ⇒ Object



32
33
34
35
36
37
# File 'lib/activejob/temporal/payload_serializers.rb', line 32

def normalize_name(name)
  normalized = name.to_sym
  normalized == MESSAGE_PACK_ALIAS ? MESSAGE_PACK : normalized
rescue NoMethodError
  name
end