public final class AvroSerdes extends Object
A
) using AVDL, and then set up the Avro Maven plugin to generate Java objects that correspond to your AVDL definitions. An
example of how to do this is available in the pom.xml
file for this module. These generated classes are of type SpecificRecord
,
so you can choose A
to be SpecifiRecord
.
You can then use the AvroSerdes.Specific
methods to generate all the Serdes you need without having to do any custom marshalling.
If choose a different concrete type for A
, you can use the methods of below
, but it does require you to provide an
appropriate payloadSerde
for A
, which may involve writing a little more boilerplate code.
Modifier and Type | Class and Description |
---|---|
static interface |
AvroSerdes.Generic
Factory methods which can be used where
A is a subclass of GenericRecord . |
static interface |
AvroSerdes.Specific
Factory methods which can be used where
A is a subclass of SpecificRecord . |
Constructor and Description |
---|
AvroSerdes() |
Modifier and Type | Method and Description |
---|---|
static <A> ActionSerdes<A> |
actionSerdes(org.apache.kafka.common.serialization.Serde<A> payloadSerde,
String schemaRegistryUrl,
boolean useMockSchemaRegistry)
Create action serdes (serdes required for serializing to and from action request and response topics)
|
static <A> SagaClientSerdes<A> |
sagaClientSerdes(org.apache.kafka.common.serialization.Serde<A> payloadSerde,
String schemaRegistryUrl,
boolean useMockSchemaRegistry)
Saga client serdes (serdes required for the saga request and response topics)
|
static <A> SagaSerdes<A> |
sagaSerdes(org.apache.kafka.common.serialization.Serde<A> payloadSerde,
String schemaRegistryUrl,
boolean useMockSchemaRegistry)
Saga serdes (saga client topics, as well as the saga internal state and state transition topics)
|
public static <A> ActionSerdes<A> actionSerdes(org.apache.kafka.common.serialization.Serde<A> payloadSerde, String schemaRegistryUrl, boolean useMockSchemaRegistry)
A
- a representation of an action command that is shared across all actions in the saga. This is typically a generic type, such as Json, or if using Avro serialization, SpecificRecord or GenericRecordpayloadSerde
- the payload serde required for serializing to and from the shared action command type A
schemaRegistryUrl
- the schema registry urluseMockSchemaRegistry
- the use mock schema registrypublic static <A> SagaClientSerdes<A> sagaClientSerdes(org.apache.kafka.common.serialization.Serde<A> payloadSerde, String schemaRegistryUrl, boolean useMockSchemaRegistry)
A
- a representation of an action command that is shared across all actions in the saga. This is typically a generic type, such as Json, or if using Avro serialization, SpecificRecord or GenericRecordpayloadSerde
- the payload serde required for serializing to and from the shared action command type A
schemaRegistryUrl
- the schema registry urluseMockSchemaRegistry
- the use mock schema registrypublic static <A> SagaSerdes<A> sagaSerdes(org.apache.kafka.common.serialization.Serde<A> payloadSerde, String schemaRegistryUrl, boolean useMockSchemaRegistry)
A
- a representation of an action command that is shared across all actions in the saga. This is typically a generic type, such as Json, or if using Avro serialization, SpecificRecord or GenericRecordpayloadSerde
- the payload serde required for serializing to and from the shared action command type A
schemaRegistryUrl
- the schema registry urluseMockSchemaRegistry
- the use mock schema registryCopyright © 2019. All rights reserved.