Class KafkaOffset
Represents the position of the message in a partition.
Implements
Inherited Members
Namespace: Silverback.Messaging.Broker
Assembly: Silverback.Integration.Kafka.dll
Syntax
public sealed record KafkaOffset : IBrokerMessageIdentifier, IEquatable<IBrokerMessageIdentifier>, IComparable<KafkaOffset>, IComparable, IEquatable<KafkaOffset>
Constructors
KafkaOffset(TopicPartition, Offset)
Initializes a new instance of the KafkaOffset class.
Declaration
public KafkaOffset(TopicPartition topicPartition, Offset offset)
Parameters
| Type | Name | Description |
|---|---|---|
| TopicPartition | topicPartition | The Confluent.Kafka.TopicPartition. |
| Offset | offset | The offset in the partition. |
KafkaOffset(TopicPartitionOffset)
Initializes a new instance of the KafkaOffset class.
Declaration
public KafkaOffset(TopicPartitionOffset topicPartitionOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| TopicPartitionOffset | topicPartitionOffset | The Confluent.Kafka.TopicPartitionOffset. |
KafkaOffset(string, int, long)
Initializes a new instance of the KafkaOffset class.
Declaration
public KafkaOffset(string topic, int partition, long offset)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topic | The topic. |
| int | partition | The partition. |
| long | offset | The offset in the partition. |
Properties
IsSpecial
Gets a value indicating whether the offset is one of the special values (i.e. Confluent.Kafka.Offset.Unset, Confluent.Kafka.Offset.Beginning, Confluent.Kafka.Offset.End).
Declaration
public bool IsSpecial { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Offset
Gets the offset in the partition.
Declaration
public Offset Offset { get; }
Property Value
| Type | Description |
|---|---|
| Offset |
TopicPartition
Gets the topic and partition.
Declaration
public TopicPartition TopicPartition { get; }
Property Value
| Type | Description |
|---|---|
| TopicPartition |
Methods
CompareTo(KafkaOffset?)
Represents the position of the message in a partition.
Declaration
public int CompareTo(KafkaOffset? other)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaOffset | other |
Returns
| Type | Description |
|---|---|
| int |
CompareTo(object?)
Represents the position of the message in a partition.
Declaration
public int CompareTo(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| int |
Equals(IBrokerMessageIdentifier?)
Represents the position of the message in a partition.
Declaration
public bool Equals(IBrokerMessageIdentifier? other)
Parameters
| Type | Name | Description |
|---|---|---|
| IBrokerMessageIdentifier | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(KafkaOffset?)
Represents the position of the message in a partition.
Declaration
public bool Equals(KafkaOffset? other)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaOffset | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object?)
Represents the position of the message in a partition.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
GetHashCode()
Represents the position of the message in a partition.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
ToLogString()
Gets a string that can be used to log the identifier/offset value.
Declaration
public string ToLogString()
Returns
| Type | Description |
|---|---|
| string | A string representing the identifier/offset value. |
Remarks
This string should contain all identifiers except the endpoint name.
ToString()
Represents the position of the message in a partition.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
ToVerboseLogString()
Gets a string that can be used to log the identifier/offset value.
Declaration
public string ToVerboseLogString()
Returns
| Type | Description |
|---|---|
| string | A string representing the identifier/offset value. |
Remarks
This string must include the endpoint name, if the identifier value isn't unique across different endpoints.
Operators
operator ==(KafkaOffset?, KafkaOffset?)
Represents the position of the message in a partition.
Declaration
public static bool operator ==(KafkaOffset? left, KafkaOffset? right)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaOffset | left | |
| KafkaOffset | right |
Returns
| Type | Description |
|---|---|
| bool |
operator >(KafkaOffset, KafkaOffset)
Greater than operator.
Declaration
public static bool operator >(KafkaOffset left, KafkaOffset right)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaOffset | left | Left-hand operand. |
| KafkaOffset | right | Right-hand operand. |
Returns
| Type | Description |
|---|---|
| bool |
operator >=(KafkaOffset, KafkaOffset)
Greater than or equal operator.
Declaration
public static bool operator >=(KafkaOffset left, KafkaOffset right)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaOffset | left | Left-hand operand. |
| KafkaOffset | right | Right-hand operand. |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(KafkaOffset?, KafkaOffset?)
Represents the position of the message in a partition.
Declaration
public static bool operator !=(KafkaOffset? left, KafkaOffset? right)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaOffset | left | |
| KafkaOffset | right |
Returns
| Type | Description |
|---|---|
| bool |
operator <(KafkaOffset, KafkaOffset)
Less than operator.
Declaration
public static bool operator <(KafkaOffset left, KafkaOffset right)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaOffset | left | Left-hand operand. |
| KafkaOffset | right | Right-hand operand. |
Returns
| Type | Description |
|---|---|
| bool |
operator <=(KafkaOffset, KafkaOffset)
Less than or equal operator.
Declaration
public static bool operator <=(KafkaOffset left, KafkaOffset right)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaOffset | left | Left-hand operand. |
| KafkaOffset | right | Right-hand operand. |
Returns
| Type | Description |
|---|---|
| bool |