Interface IInMemoryPartition
- Namespace
- Silverback.Messaging.Broker.Kafka.Mocks
- Assembly
- Silverback.Integration.Kafka.Testing.dll
A mocked topic partition where the messages are just stored in memory.
public interface IInMemoryPartition
Properties
FirstOffset
Gets the Confluent.Kafka.Offset of the first message in the partition.
Offset FirstOffset { get; }
Property Value
- Offset
LastOffset
Gets the Confluent.Kafka.Offset of the latest message in the partition.
Offset LastOffset { get; }
Property Value
- Offset
Partition
Gets the Partition (index).
Partition Partition { get; }
Property Value
- Partition
TotalMessagesCount
Gets the total number of messages written to the partition.
int TotalMessagesCount { get; }
Property Value
Methods
GetAllMessages()
Gets all messages currently stored in the partition.
IReadOnlyCollection<Message<byte[]?, byte[]?>> GetAllMessages()
Returns
- IReadOnlyCollection<Message<byte[], byte[]>>
The messages.
TryPull(Offset, out ConsumeResult<byte[]?, byte[]?>?)
Pulls the next message from the partition, if available.
bool TryPull(Offset offset, out ConsumeResult<byte[]?, byte[]?>? result)
Parameters
offsetOffsetThe offset of the next message to be pulled.
resultConsumeResult<byte[], byte[]>The Confluent.Kafka.ConsumeResult<TKey, TValue> wrapping the pulled message.
Returns
- bool
A value indicating whether a message was available for pulling.