Class SerializationUtils
java.lang.Object
org.springframework.kafka.support.serializer.SerializationUtils
Utilities for serialization.
- Since:
- 2.5
- Author:
- Gary Russell
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
deserializationException
(org.apache.kafka.common.header.Headers headers, byte[] data, Exception ex, boolean isForKeyArg) Populate the record headers with a serializedDeserializationException
.static <P,
T> BiFunction<P, org.apache.kafka.common.header.Headers, T> propertyToMethodInvokingFunction
(String methodProperty, Class<P> payloadType, ClassLoader classLoader) Convert a property value (FQCN.methodName) to aBiFunction
that takes a payload and headers and returns some value.
-
Field Details
-
DESERIALIZER_EXCEPTION_HEADER_PREFIX
Header name for deserialization exceptions.- Since:
- 2.8
- See Also:
-
KEY_DESERIALIZER_EXCEPTION_HEADER
Header name for deserialization exceptions.- Since:
- 2.8
- See Also:
-
VALUE_DESERIALIZER_EXCEPTION_HEADER
Header name for deserialization exceptions.- Since:
- 2.8
- See Also:
-
-
Method Details
-
propertyToMethodInvokingFunction
public static <P,T> BiFunction<P,org.apache.kafka.common.header.Headers, propertyToMethodInvokingFunctionT> (String methodProperty, Class<P> payloadType, ClassLoader classLoader) Convert a property value (FQCN.methodName) to aBiFunction
that takes a payload and headers and returns some value. The method must have parameters(P, Headers)
or(P)
and be declared as static.- Type Parameters:
P
- TheBiFunction
first parameter type.T
- TheBiFunction
return type.- Parameters:
methodProperty
- the method name property.payloadType
- theBiFunction
first parameter type.classLoader
- the class loader.- Returns:
- the function.
-
deserializationException
public static void deserializationException(org.apache.kafka.common.header.Headers headers, byte[] data, Exception ex, boolean isForKeyArg) Populate the record headers with a serializedDeserializationException
.- Parameters:
headers
- the headers.data
- the data.ex
- the exception.isForKeyArg
- true if this is a key deserialization problem, otherwise value.- Since:
- 2.8
-