Show / Hide Table of Contents

Class KafkaConsumer<TMessage>

Kafka-consumer для обработки сообщений определённого типа.

Inheritance
object
KafkaConsumer<TMessage>
Implements
IKafkaConsumer<TMessage>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: NotifyHub.Kafka.Services
Assembly: NotifyHub.Kafka.dll
Syntax
public class KafkaConsumer<TMessage> : IKafkaConsumer<TMessage> where TMessage : class
Type Parameters
Name Description
TMessage

Тип ожидаемого сообщения.

Constructors

| Edit this page View Source

KafkaConsumer(IOptions<KafkaOptions>, ILogger<KafkaConsumer<TMessage>>)

Declaration
public KafkaConsumer(IOptions<KafkaOptions> options, ILogger<KafkaConsumer<TMessage>> logger)
Parameters
Type Name Description
IOptions<KafkaOptions> options
ILogger<KafkaConsumer<TMessage>> logger

Methods

| Edit this page View Source

Close()

Закрывает Kafka-consumer и освобождает ресурсы.

Declaration
public void Close()
| Edit this page View Source

ConsumeAsync(string, CancellationToken)

Получение сообщений из Kafka.

Declaration
public Task<TMessage?> ConsumeAsync(string topicKey, CancellationToken cancellationToken)
Parameters
Type Name Description
string topicKey

Ключ топика из настроек

CancellationToken cancellationToken

Токен отмены операции.

Returns
Type Description
Task<TMessage>

Implements

IKafkaConsumer<TMessage>
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX