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 class KafkaOffset : IBrokerMessageOffset, IBrokerMessageIdentifier, IEquatable<IBrokerMessageIdentifier>, IComparable<IBrokerMessageOffset>
Constructors
| Improve this doc View sourceKafkaOffset(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 name of the topic. |
| int | partition | The partition number. |
| long | offset | The offset in the partition. |
KafkaOffset(string, string)
Initializes a new instance of the KafkaOffset class.
Declaration
public KafkaOffset(string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The unique key of the queue, topic or partition the message was produced to or consumed from. |
| string | value | The identifier value. |
Properties
| Improve this doc View sourceKey
Gets the unique key of the queue, topic or partition the message was produced to or consumed from.
Declaration
public string Key { get; }
Property Value
| Type | Description |
|---|---|
| string |
Offset
Gets the offset in the partition.
Declaration
public long Offset { get; }
Property Value
| Type | Description |
|---|---|
| long |
Partition
Gets the partition number.
Declaration
public int Partition { get; }
Property Value
| Type | Description |
|---|---|
| int |
Topic
Gets the name of the topic.
Declaration
public string Topic { get; }
Property Value
| Type | Description |
|---|---|
| string |
Value
Gets the identifier value.
Declaration
public string Value { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Improve this doc View sourceCompareTo(IBrokerMessageOffset?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Declaration
public int CompareTo(IBrokerMessageOffset? other)
Parameters
| Type | Name | Description |
|---|---|---|
| IBrokerMessageOffset | other | An object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| int | A value that indicates the relative order of the objects being compared. The return value has these meanings: Meaning Less than zero This instance precedes Zero This instance occurs in the same position in the sort order as Greater than zero This instance follows |
CompareTo(KafkaOffset?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Declaration
public int CompareTo(KafkaOffset? other)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaOffset | other | An object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| int | A value less than zero if this is less than object, zero if this is equal to object, or a value greater than zero if this is greater than object. |
Equals(IBrokerMessageIdentifier?)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(IBrokerMessageIdentifier? other)
Parameters
| Type | Name | Description |
|---|---|---|
| IBrokerMessageIdentifier | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| bool | true if the current object is equal to the |
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
| Improve this doc View sourceGetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
Overrides
| Improve this doc View sourceToLogString()
Gets a string that can be used to log the offset value.
Declaration
public string ToLogString()
Returns
| Type | Description |
|---|---|
| string | A string representing the offset value. |
Remarks
This string should contain all identifiers except the endpoint name.
ToVerboseLogString()
Gets a string that can be used to log the offset value.
Declaration
public string ToVerboseLogString()
Returns
| Type | Description |
|---|---|
| string | A string representing the offset value. |
Remarks
This string must include the endpoint name, if the identifier value isn't unique across different endpoints.
Operators
| Improve this doc View sourceoperator ==(KafkaOffset?, KafkaOffset?)
Equality 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 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)
Inequality 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 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 |