Class AvroMessageDeserializer<TMessage>
Connects to the specified schema registry and serializes the messages in Apache Avro format.
Inherited Members
Namespace: Silverback.Messaging.Serialization
Assembly: Silverback.Integration.Kafka.SchemaRegistry.dll
Syntax
public class AvroMessageDeserializer<TMessage> : AvroMessageDeserializerBase, IKafkaMessageSerializer, IMessageSerializer where TMessage : class
Type Parameters
Name | Description |
---|---|
TMessage | The type of the messages to be serialized and/or deserialized. |
Methods
| Improve this doc View sourceDeserializeAsync(Stream, MessageHeaderCollection, MessageSerializationContext)
Deserializes the byte array back into a message object.
Declaration
public override async ValueTask<(object Message, Type MessageType)> DeserializeAsync(Stream messageStream, MessageHeaderCollection messageHeaders, MessageSerializationContext context)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | messageStream | The System.IO.Stream containing the message to be deserialized. |
MessageHeaderCollection | messageHeaders | The message headers collection. |
MessageSerializationContext | context | The context information. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.ValueTuple<System.Object, System.Type>> | A System.Threading.Tasks.Task<TResult> representing the asynchronous operation. The task result contains the
deserialized message (or |
Overrides
| Improve this doc View sourceDeserializeKey(Byte[], IReadOnlyCollection<MessageHeader>, MessageSerializationContext)
Deserializes the byte array back into a key string.
Declaration
public override string DeserializeKey(byte[] key, IReadOnlyCollection<MessageHeader> messageHeaders, MessageSerializationContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | key | The byte array to be deserialized. |
System.Collections.Generic.IReadOnlyCollection<MessageHeader> | messageHeaders | The message headers collection. |
MessageSerializationContext | context | The context information. |
Returns
Type | Description |
---|---|
System.String | The deserialized key. |
Overrides
| Improve this doc View sourceSerializeAsync(Object, MessageHeaderCollection, MessageSerializationContext)
Serializes the specified message object into a byte array.
Declaration
public override ValueTask<Stream> SerializeAsync(object message, MessageHeaderCollection messageHeaders, MessageSerializationContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | message | The message object to be serialized. |
MessageHeaderCollection | messageHeaders | The message headers collection. |
MessageSerializationContext | context | The context information. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.IO.Stream> | A System.Threading.Tasks.Task<TResult> representing the asynchronous operation. The task result contains the System.IO.Stream with the serialized message. |
Overrides
| Improve this doc View sourceSerializeKey(String, IReadOnlyCollection<MessageHeader>, MessageSerializationContext)
Serializes the specified key string into a byte array.
Declaration
public override byte[] SerializeKey(string key, IReadOnlyCollection<MessageHeader> messageHeaders, MessageSerializationContext context)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The message key to be serialized. |
System.Collections.Generic.IReadOnlyCollection<MessageHeader> | messageHeaders | The message headers collection. |
MessageSerializationContext | context | The context information. |
Returns
Type | Description |
---|---|
System.Byte[] | The serialization result. |