Definition
Assembly: CloudNimble.SimpleMessageBus.Dispatch.Kafka.dll Namespace: CloudNimble.SimpleMessageBus.Dispatch.Kafka Inheritance: System.ObjectSyntax
Summary
Processes messages from Apache Kafka and dispatches them to registered message handlers.Remarks
This processor integrates with Azure WebJobs to automatically trigger message processing when messages arrive in a Kafka topic. It handles message deserialization, lifecycle management, and provides proper logging and dependency injection scope for each message. Unlike Azure Storage Queues, Kafka does not require explicit message deletion. The WebJobs Kafka extension automatically commits offsets after successful processing. If processing fails, the message will be reprocessed based on the consumer group’s offset configuration.Examples
Constructors
.ctor
Creates a new instance of KafkaProcessor.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
dispatcher | CloudNimble.SimpleMessageBus.Dispatch.IMessageDispatcher | The message dispatcher to route messages to handlers. |
serviceScopeFactory | Microsoft.Extensions.DependencyInjection.IServiceScopeFactory | Factory for creating DI scopes per message. |
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException | Thrown when dispatcher or serviceScopeFactory is null. |
.ctor Inherited
Inherited from
objectSyntax
Methods
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | - |
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
ProcessKafkaMessage
Processes a message from the Kafka topic and dispatches it to registered handlers.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
kafkaEvent | Microsoft.Azure.WebJobs.Extensions.Kafka.KafkaEventData<string> | The Kafka event containing the message payload. |
logger | Microsoft.Extensions.Logging.ILogger | The logger instance for this processing operation. |
Returns
Type:System.Threading.Tasks.Task
A Task representing the asynchronous operation.
Remarks
This method is triggered automatically by the WebJobs Kafka extension when messages arrive. It deserializes the message envelope, sets up processing context, and dispatches to handlers. The offset is automatically committed after successful processing. If an exception is thrown, the offset is not committed and the message will be reprocessed.ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Related APIs
- CloudNimble.SimpleMessageBus.Dispatch.IQueueProcessor