MessageEntity
- The message entity being serialized/deserialized.public interface MessageSerializer<MessageEntity,WireFormat>
StrictMessageSerializer
, which serializes messages that are primarily in
memory, to and from ByteString
, and StreamedMessageSerializer
, which serializes streams of messages.
Note that all message serializers used by the framework must implement one of these two sub interfaces, the
framework does not know how to handle other serializer types.Modifier and Type | Interface and Description |
---|---|
static interface |
MessageSerializer.NegotiatedDeserializer<MessageEntity,WireFormat>
A negotiated deserializer.
|
static interface |
MessageSerializer.NegotiatedSerializer<MessageEntity,WireFormat>
A negotiated serializer.
|
Modifier and Type | Method and Description |
---|---|
default org.pcollections.PSequence<MessageProtocol> |
acceptResponseProtocols()
The message headers that will be accepted for response serialization.
|
MessageSerializer.NegotiatedDeserializer<MessageEntity,WireFormat> |
deserializer(MessageProtocol protocol)
Get a deserializer for an entity described by the given request or response protocol.
|
default boolean |
isStreamed()
Whether this serializer is a streamed serializer or not.
|
default boolean |
isUsed()
Whether this serializer serializes values that are used or not.
|
MessageSerializer.NegotiatedSerializer<MessageEntity,WireFormat> |
serializerForRequest()
Get a serializer for a client request.
|
MessageSerializer.NegotiatedSerializer<MessageEntity,WireFormat> |
serializerForResponse(java.util.List<MessageProtocol> acceptedMessageProtocols)
Negotiate a serializer for the response, given the accepted message headers.
|
default org.pcollections.PSequence<MessageProtocol> acceptResponseProtocols()
default boolean isUsed()
NotUsed
type.default boolean isStreamed()
MessageSerializer.NegotiatedSerializer<MessageEntity,WireFormat> serializerForRequest()
MessageSerializer.NegotiatedDeserializer<MessageEntity,WireFormat> deserializer(MessageProtocol protocol) throws UnsupportedMediaType
protocol
- The protocol of the message request or response associated with teh entity.UnsupportedMediaType
- If the deserializer can't deserialize that protocol.MessageSerializer.NegotiatedSerializer<MessageEntity,WireFormat> serializerForResponse(java.util.List<MessageProtocol> acceptedMessageProtocols) throws NotAcceptable
acceptedMessageProtocols
- The accepted message headers is a list of message headers that will be accepted by
the client. Any empty values in a message protocol, including the list itself,
indicate that any format is acceptable.NotAcceptable
- If the serializer can't meet the requirements of any of the accept headers.