Class JsonMessageConverter
java.lang.Object
org.springframework.kafka.support.converter.MessagingMessageConverter
org.springframework.kafka.support.converter.JsonMessageConverter
- All Implemented Interfaces:
MessageConverter, RecordMessageConverter
- Direct Known Subclasses:
ByteArrayJsonMessageConverter, BytesJsonMessageConverter, StringJsonMessageConverter
@Deprecated(forRemoval=true,
since="4.0")
public class JsonMessageConverter
extends MessagingMessageConverter
Deprecated, for removal: This API element is subject to removal in a future version.
Base class for JSON message converters; on the consumer side, it can
handle
byte[], Bytes and String record values.
On the producer side, select a subclass that matches the corresponding
Kafka Serializer.- Since:
- 2.3
-
Field Summary
Fields inherited from class MessagingMessageConverter
logger -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.JsonMessageConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable ObjectconvertPayload(org.springframework.messaging.Message<?> message) Deprecated, for removal: This API element is subject to removal in a future version.Subclasses can convert the payload; by default, it's sent unchanged to Kafka.protected ObjectextractAndConvertValue(org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record, @Nullable Type type) Deprecated, for removal: This API element is subject to removal in a future version.Subclasses can convert the value; by default, it's returned as provided by Kafka unless there is aSmartMessageConverterthat can convert it.protected com.fasterxml.jackson.databind.ObjectMapperDeprecated, for removal: This API element is subject to removal in a future version.Return the object mapper.Deprecated, for removal: This API element is subject to removal in a future version.protected org.apache.kafka.common.header.HeadersinitialRecordHeaders(org.springframework.messaging.Message<?> message) Deprecated, for removal: This API element is subject to removal in a future version.Subclasses can populate additional headers before they are mapped.voidsetTypeMapper(Jackson2JavaTypeMapper typeMapper) Deprecated, for removal: This API element is subject to removal in a future version.Set a customized type mapper.Methods inherited from class MessagingMessageConverter
fromMessage, getMessagingConverter, setGenerateMessageId, setGenerateTimestamp, setHeaderMapper, setMessagingConverter, setRawRecordHeader, toMessageMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MessageConverter
commonHeaders
-
Constructor Details
-
JsonMessageConverter
public JsonMessageConverter()Deprecated, for removal: This API element is subject to removal in a future version. -
JsonMessageConverter
public JsonMessageConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
getTypeMapper
Deprecated, for removal: This API element is subject to removal in a future version. -
setTypeMapper
Deprecated, for removal: This API element is subject to removal in a future version.Set a customized type mapper.- Parameters:
typeMapper- the type mapper.
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()Deprecated, for removal: This API element is subject to removal in a future version.Return the object mapper.- Returns:
- the mapper.
-
initialRecordHeaders
protected org.apache.kafka.common.header.Headers initialRecordHeaders(org.springframework.messaging.Message<?> message) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:MessagingMessageConverterSubclasses can populate additional headers before they are mapped.- Overrides:
initialRecordHeadersin classMessagingMessageConverter- Parameters:
message- the message.- Returns:
- the headers
-
convertPayload
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:MessagingMessageConverterSubclasses can convert the payload; by default, it's sent unchanged to Kafka.- Overrides:
convertPayloadin classMessagingMessageConverter- Parameters:
message- the message.- Returns:
- the payload.
-
extractAndConvertValue
protected Object extractAndConvertValue(org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record, @Nullable Type type) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:MessagingMessageConverterSubclasses can convert the value; by default, it's returned as provided by Kafka unless there is aSmartMessageConverterthat can convert it.- Overrides:
extractAndConvertValuein classMessagingMessageConverter- Parameters:
record- the record.type- the required type.- Returns:
- the value.
-
JacksonJsonMessageConverterfor Jackson 3.