public class AvroSchemaMessageConverter extends AbstractAvroMessageConverter
MessageConverter
using Apache Avro.
The schema for serializing and deserializing will be automatically inferred from the
class for SpecificRecord
and regular classes, unless a
specific schema is set, case in which that schema will be used instead. For converting
to GenericRecord
targets, a schema must be set.sConstructor and Description |
---|
AvroSchemaMessageConverter()
Create a
AvroSchemaMessageConverter . |
AvroSchemaMessageConverter(Collection<org.springframework.util.MimeType> supportedMimeTypes)
Create a
AvroSchemaMessageConverter . |
AvroSchemaMessageConverter(org.springframework.util.MimeType supportedMimeType)
Create a
AvroSchemaMessageConverter . |
Modifier and Type | Method and Description |
---|---|
org.apache.avro.Schema |
getSchema() |
protected org.apache.avro.Schema |
resolveReaderSchemaForDeserialization(Class<?> targetClass) |
protected org.apache.avro.Schema |
resolveSchemaForWriting(Object payload,
org.springframework.messaging.MessageHeaders headers,
org.springframework.util.MimeType hintedContentType) |
protected org.apache.avro.Schema |
resolveWriterSchemaForDeserialization(org.springframework.util.MimeType mimeType) |
void |
setSchema(org.apache.avro.Schema schema)
Sets the Apache Avro schema to be used by this converter.
|
void |
setSchemaLocation(org.springframework.core.io.Resource schemaLocation)
The location of the Apache Avro schema to be used by this converter.
|
protected boolean |
supports(Class<?> clazz) |
canConvertFrom, convertFromInternal, convertToInternal, getDatumReader, parseSchema
canConvertTo, fromMessage, fromMessage, getContentTypeResolver, getDefaultContentType, getMimeType, getSerializedPayloadClass, getSupportedMimeTypes, isStrictContentTypeMatch, setContentTypeResolver, setSerializedPayloadClass, setStrictContentTypeMatch, supportsMimeType, toMessage, toMessage
public AvroSchemaMessageConverter()
public AvroSchemaMessageConverter(org.springframework.util.MimeType supportedMimeType)
AvroSchemaMessageConverter
. The converter will be used for the
provided MimeType
.supportedMimeType
- mime type to be supported by
AvroSchemaMessageConverter
public AvroSchemaMessageConverter(Collection<org.springframework.util.MimeType> supportedMimeTypes)
AvroSchemaMessageConverter
. The converter will be used for the
provided MimeType
s.supportedMimeTypes
- the mime types supported by this converterpublic org.apache.avro.Schema getSchema()
public void setSchema(org.apache.avro.Schema schema)
schema
- schema to be used by this converterpublic void setSchemaLocation(org.springframework.core.io.Resource schemaLocation)
schemaLocation
- the location of the schema used by this converter.protected boolean supports(Class<?> clazz)
supports
in class org.springframework.messaging.converter.AbstractMessageConverter
protected org.apache.avro.Schema resolveWriterSchemaForDeserialization(org.springframework.util.MimeType mimeType)
resolveWriterSchemaForDeserialization
in class AbstractAvroMessageConverter
protected org.apache.avro.Schema resolveReaderSchemaForDeserialization(Class<?> targetClass)
resolveReaderSchemaForDeserialization
in class AbstractAvroMessageConverter
protected org.apache.avro.Schema resolveSchemaForWriting(Object payload, org.springframework.messaging.MessageHeaders headers, org.springframework.util.MimeType hintedContentType)
resolveSchemaForWriting
in class AbstractAvroMessageConverter
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.