> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.nimbleapps.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# IHostBuilder

> Extension methods for IHostBuilder from Microsoft.Extensions.Hosting.Abstractions

## Definition

**Assembly:** Microsoft.Extensions.Hosting.Abstractions.dll

**Namespace:** Microsoft.Extensions.Hosting

## Syntax

```csharp theme={"dark"}
Microsoft.Extensions.Hosting.IHostBuilder
```

## Summary

This type is defined in Microsoft.Extensions.Hosting.Abstractions.

## Remarks

See [Microsoft documentation](https://learn.microsoft.com/dotnet/api/microsoft.extensions.hosting.ihostbuilder) for more information about the rest of the API.

## Methods

### &#x20;UseAmazonSQSMessagePublisher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_Amazon_IHostBuilderExtensions`

Configures SimpleMessageBus to use Amazon SQS as the backing queue and registers the [AmazonSQSMessagePublisher](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Publish/Amazon/AmazonSQSMessagePublisher.md) with the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseAmazonSQSMessagePublisher(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseAmazonSQSMessagePublisher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_Amazon_IHostBuilderExtensions`

Configures SimpleMessageBus to use Amazon SQS as the backing queue and registers the [AmazonSQSMessagePublisher](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Publish/Amazon/AmazonSQSMessagePublisher.md) with the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseAmazonSQSMessagePublisher(Microsoft.Extensions.Hosting.IHostBuilder builder, System.Action<CloudNimble.SimpleMessageBus.Amazon.Core.AmazonSQSOptions> amazonSQSOptions)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |
| `amazonSQSOptions` | `System.Action<CloudNimble.SimpleMessageBus.Amazon.Core.AmazonSQSOptions>` | An [Action\`1](https://learn.microsoft.com/dotnet/api/system.action-1) that gives you a fluent interface for configuring the options for a queue backed by Amazon SQS. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseAmazonSQSProcessor Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.DispatchAmazon_IHostBuilderExtensions`

Configures SimpleMessageBus to use Amazon SQS as the backing queue and registers the [AmazonSQSProcessor](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Amazon/AmazonSQSProcessor.md) with the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseAmazonSQSProcessor(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseAmazonSQSProcessor Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.DispatchAmazon_IHostBuilderExtensions`

Configures SimpleMessageBus to use Amazon SQS as the backing queue and registers the [AmazonSQSProcessor](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Amazon/AmazonSQSProcessor.md) with the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseAmazonSQSProcessor(Microsoft.Extensions.Hosting.IHostBuilder builder, System.Action<CloudNimble.SimpleMessageBus.Amazon.Core.AmazonSQSOptions> amazonSQSOptions)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |
| `amazonSQSOptions` | `System.Action<CloudNimble.SimpleMessageBus.Amazon.Core.AmazonSQSOptions>` | An [Action\`1](https://learn.microsoft.com/dotnet/api/system.action-1) that gives you a fluent interface for configuring the options for a queue backed by Amazon SQS. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseAzureStorageQueueMessagePublisher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IHostBuilderExtensions`

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseAzureStorageQueueMessagePublisher(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseAzureStorageQueueMessagePublisher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IHostBuilderExtensions`

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseAzureStorageQueueMessagePublisher(Microsoft.Extensions.Hosting.IHostBuilder builder, System.Action<CloudNimble.SimpleMessageBus.Core.AzureStorageQueueOptions> azureQueueOptions)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |
| `azureQueueOptions` | `System.Action<CloudNimble.SimpleMessageBus.Core.AzureStorageQueueOptions>` | - |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseAzureStorageQueueProcessor Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.IHostBuilderExtensions`

Configures SimpleMessageBus to use Azure Storage Queues as the backing queue and registers the [AzureStorageQueueProcessor](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/AzureStorageQueueProcessor.md) with the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseAzureStorageQueueProcessor(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseAzureStorageQueueProcessor Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.IHostBuilderExtensions`

Configures SimpleMessageBus to use Azure Storage Queues as the backing queue and registers the [AzureStorageQueueProcessor](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/AzureStorageQueueProcessor.md) with the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseAzureStorageQueueProcessor(Microsoft.Extensions.Hosting.IHostBuilder builder, System.Action<CloudNimble.SimpleMessageBus.Core.AzureStorageQueueOptions> azureQueueOptions)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |
| `azureQueueOptions` | `System.Action<CloudNimble.SimpleMessageBus.Core.AzureStorageQueueOptions>` | An [Action\`1](https://learn.microsoft.com/dotnet/api/system.action-1) that gives you a fluent interface for configuring the options for a queue backed by Azure Queue Storage. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseFileSystemMessagePublisher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IHostBuilderExtensions`

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseFileSystemMessagePublisher(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseFileSystemMessagePublisher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IHostBuilderExtensions`

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseFileSystemMessagePublisher(Microsoft.Extensions.Hosting.IHostBuilder builder, System.Action<CloudNimble.SimpleMessageBus.Core.FileSystemOptions> fileSystemOptions)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |
| `fileSystemOptions` | `System.Action<CloudNimble.SimpleMessageBus.Core.FileSystemOptions>` | - |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseFileSystemQueueProcessor Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.FileSystem_IHostBuilderExtensions`

Configures SimpleMessageBus to use the local file system as the backing queue and registers the [FileSystemQueueProcessor](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/FileSystemQueueProcessor.md) with the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseFileSystemQueueProcessor(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseFileSystemQueueProcessor Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.FileSystem_IHostBuilderExtensions`

Configures SimpleMessageBus to use the local file system as the backing queue and registers the [FileSystemQueueProcessor](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/FileSystemQueueProcessor.md) with the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseFileSystemQueueProcessor(Microsoft.Extensions.Hosting.IHostBuilder builder, System.Action<CloudNimble.SimpleMessageBus.Core.FileSystemOptions> fileSystemOptions)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |
| `fileSystemOptions` | `System.Action<CloudNimble.SimpleMessageBus.Core.FileSystemOptions>` | An [Action\`1](https://learn.microsoft.com/dotnet/api/system.action-1) that gives you a fluent interface for configuring the options for a queue backed by the file system.. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseIndexedDbMessagePublisher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IndexedDb_IHostBuilderExtensions`

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseIndexedDbMessagePublisher(Microsoft.Extensions.Hosting.IHostBuilder builder, string configSectionName = "SimpleMessageBus:IndexedDb", System.Action<CloudNimble.SimpleMessageBus.IndexedDb.Core.IndexedDbOptions> indexedDbOptions = null)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |
| `configSectionName` | `string` | The name of the [ConfigurationSection](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.configurationsection) to load the [IndexedDbOptions](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/IndexedDb/Core/IndexedDbOptions.md) from. Defaults to 'SimpleMessageBus:IndexedDb'. |
| `indexedDbOptions` | `System.Action<CloudNimble.SimpleMessageBus.IndexedDb.Core.IndexedDbOptions>` | An [Action\`1](https://learn.microsoft.com/dotnet/api/system.action-1) lambda that allows you to set the [IndexedDbOptions](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/IndexedDb/Core/IndexedDbOptions.md) inline. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent configuration.

### &#x20;UseKafkaMessagePublisher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_Kafka_IHostBuilderExtensions`

Configures SimpleMessageBus to publish messages to Apache Kafka.
Reads configuration from the "KafkaOptions" section of IConfiguration.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseKafkaMessagePublisher(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *builder* is null. |

#### Examples

```csharp theme={"dark"}
Host.CreateDefaultBuilder()
    .UseKafkaMessagePublisher()
    .Build()
    .Run();
```

### &#x20;UseKafkaMessagePublisher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_Kafka_IHostBuilderExtensions`

Configures SimpleMessageBus to publish messages to Apache Kafka.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseKafkaMessagePublisher(Microsoft.Extensions.Hosting.IHostBuilder builder, System.Action<CloudNimble.SimpleMessageBus.Core.KafkaOptions> kafkaOptions)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |
| `kafkaOptions` | `System.Action<CloudNimble.SimpleMessageBus.Core.KafkaOptions>` | An [Action\`1](https://learn.microsoft.com/dotnet/api/system.action-1) that provides a fluent interface for configuring Kafka options. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *builder* or *kafkaOptions* is null. |

#### Examples

```csharp theme={"dark"}
Host.CreateDefaultBuilder()
    .UseKafkaMessagePublisher(options =&gt;
    {
        options.BrokerList = "localhost:9092";
        options.TopicName = "my-events";
    })
    .Build()
    .Run();
```

### &#x20;UseKafkaProcessor Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Dispatch_Kafka_IHostBuilderExtensions`

Configures SimpleMessageBus to process messages from Apache Kafka and registers the [KafkaProcessor](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Kafka/KafkaProcessor.md) with the DI container.
Reads configuration from the "KafkaOptions" section of IConfiguration.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseKafkaProcessor(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *builder* is null. |

#### Examples

```csharp theme={"dark"}
Host.CreateDefaultBuilder()
    .UseKafkaProcessor()
    .UseOrderedMessageDispatcher()
    .Build()
    .Run();
```

### &#x20;UseKafkaProcessor Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Dispatch_Kafka_IHostBuilderExtensions`

Configures SimpleMessageBus to process messages from Apache Kafka and registers the [KafkaProcessor](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Kafka/KafkaProcessor.md) with the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseKafkaProcessor(Microsoft.Extensions.Hosting.IHostBuilder builder, System.Action<CloudNimble.SimpleMessageBus.Core.KafkaOptions> kafkaOptions)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |
| `kafkaOptions` | `System.Action<CloudNimble.SimpleMessageBus.Core.KafkaOptions>` | An [Action\`1](https://learn.microsoft.com/dotnet/api/system.action-1) that provides a fluent interface for configuring Kafka options. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *builder* or *kafkaOptions* is null. |

#### Examples

```csharp theme={"dark"}
Host.CreateDefaultBuilder()
    .ConfigureServices(services =&gt;
    {
        services.AddSingleton&lt;IMessageHandler, MyMessageHandler&gt;();
    })
    .UseKafkaProcessor(options =&gt;
    {
        options.BrokerList = "localhost:9092";
        options.ConsumerGroup = "my-consumer";
    })
    .UseOrderedMessageDispatcher()
    .Build()
    .Run();
```

### &#x20;UseOrderedMessageDispatcher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.IHostBuilderExtensions`

Configures SimpleMessageBus to use the [OrderedMessageDispatcher](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/OrderedMessageDispatcher.md), which processes registered [IMessageHandler](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessageHandler.md)IMessageHandlers\</see> in series based on
the order they were registered in the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseOrderedMessageDispatcher(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseParallelMessageDispatcher Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.IHostBuilderExtensions`

Configures SimpleMessageBus to use the [ParallelMessageDispatcher](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/ParallelMessageDispatcher.md), which processes registered [IMessageHandler](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessageHandler.md)IMessageHandlers\</see> in parallel
regardless of the order the order they were registered in the DI container.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseParallelMessageDispatcher(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

### &#x20;UseSimpleMessageBusLifetime Extension

> [!NOTE]
>
> Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Hosting_IHostBuilderExtensions`

Configures SimpleMessageBus to use either the [WindowsServiceLifetime](https://learn.microsoft.com/dotnet/api/microsoft.extensions.hosting.windowsservices.windowsservicelifetime) or the [ConsoleLifetime](https://learn.microsoft.com/dotnet/api/microsoft.extensions.hosting.internal.consolelifetime) depending on the currently-running context.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.Hosting.IHostBuilder UseSimpleMessageBusLifetime(Microsoft.Extensions.Hosting.IHostBuilder builder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `builder` | `Microsoft.Extensions.Hosting.IHostBuilder` | The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](https://easyaf.nimbleapps.cloud/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance being configured, for fluent interaction.

#### Remarks

This method automatically detects whether the application is running as a Windows Service
and configures the appropriate lifetime management. This enables the same application
to run seamlessly in both development (console) and production (service) environments.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.