Package io.micronaut.nats.serdes
Interface NatsMessageSerDes<T>
- Type Parameters:
T
- The type to be serialized/deserialized
- All Superinterfaces:
io.micronaut.core.order.Ordered
- All Known Implementing Classes:
JavaLangNatsMessageSerDes
,JsonNatsMessageSerDes
public interface NatsMessageSerDes<T>
extends io.micronaut.core.order.Ordered
Responsible for serializing and deserializing Nats message bodies.
- Since:
- 1.0.0
- Author:
- jgrimm
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(io.nats.client.Message message, io.micronaut.core.type.Argument<T> argument) Deserializes the message into the requested type.@io.micronaut.core.annotation.Nullable byte[]
Serializes the data into a byte[] to be published to nats.boolean
Determines if this serdes supports the given type.Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Method Details
-
deserialize
@Nullable T deserialize(io.nats.client.Message message, io.micronaut.core.type.Argument<T> argument) Deserializes the message into the requested type.- Parameters:
message
- The message to deserializeargument
- The type to be returned- Returns:
- The deserialized body
-
serialize
Serializes the data into a byte[] to be published to nats.- Parameters:
data
- The data to serialize- Returns:
- The message body
-
supports
Determines if this serdes supports the given type.- Parameters:
type
- The type- Returns:
- True if the type is supported
-