25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/deimos/ext/schema_route.rb', line 25
def _deimos_setup_transcoders
payload = Transcoder.new(
schema: schema,
namespace: namespace,
use_schema_classes: use_schema_classes,
topic: name
)
key = nil
if key_config[:plain]
key = Transcoder.new(
schema: schema,
namespace: namespace,
use_schema_classes: use_schema_classes,
topic: name
)
key.backend = Deimos::SchemaBackends::Plain.new(schema: nil, namespace: nil)
elsif !key_config[:none]
if key_config[:field]
key = Transcoder.new(
schema: schema,
namespace: namespace,
use_schema_classes: use_schema_classes,
key_field: key_config[:field].to_s,
topic: name
)
elsif key_config[:schema]
key = Transcoder.new(
schema: key_config[:schema] || schema,
namespace: namespace,
use_schema_classes: use_schema_classes,
topic: self.name
)
else
raise 'No key config given - if you are not encoding keys, please use `key_config plain: true`'
end
end
deserializers.payload = payload
deserializers.key = key if key
end
|