> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.dev/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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseAmazonSQSMessagePublisher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_Amazon_IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use Amazon SQS as the backing queue and registers the [AmazonSQSMessagePublisher](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Publish/Amazon/AmazonSQSMessagePublisher) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseAmazonSQSMessagePublisher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_Amazon_IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use Amazon SQS as the backing queue and registers the [AmazonSQSMessagePublisher](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Publish/Amazon/AmazonSQSMessagePublisher) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance being configured, for fluent interaction.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseAmazonSQSProcessor <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.DispatchAmazon_IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use Amazon SQS as the backing queue and registers the [AmazonSQSProcessor](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Amazon/AmazonSQSProcessor) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseAmazonSQSProcessor <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.DispatchAmazon_IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use Amazon SQS as the backing queue and registers the [AmazonSQSProcessor](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Amazon/AmazonSQSProcessor) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance being configured, for fluent interaction.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseAzureStorageQueueMessagePublisher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IHostBuilderExtensions`</Note>

#### 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseAzureStorageQueueMessagePublisher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IHostBuilderExtensions`</Note>

#### 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |
| `azureQueueOptions` | `System.Action<CloudNimble.SimpleMessageBus.Core.AzureStorageQueueOptions>` | -                                                                                                                 |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseAzureStorageQueueProcessor <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use Azure Storage Queues as the backing queue and registers the [AzureStorageQueueProcessor](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/AzureStorageQueueProcessor) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseAzureStorageQueueProcessor <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use Azure Storage Queues as the backing queue and registers the [AzureStorageQueueProcessor](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/AzureStorageQueueProcessor) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance being configured, for fluent interaction.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseFileSystemMessagePublisher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IHostBuilderExtensions`</Note>

#### 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseFileSystemMessagePublisher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IHostBuilderExtensions`</Note>

#### 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |
| `fileSystemOptions` | `System.Action<CloudNimble.SimpleMessageBus.Core.FileSystemOptions>` | -                                                                                                                 |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseFileSystemQueueProcessor <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.FileSystem_IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use the local file system as the backing queue and registers the [FileSystemQueueProcessor](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/FileSystemQueueProcessor) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseFileSystemQueueProcessor <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.FileSystem_IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use the local file system as the backing queue and registers the [FileSystemQueueProcessor](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/FileSystemQueueProcessor) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance being configured, for fluent interaction.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseIndexedDbMessagePublisher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_IndexedDb_IHostBuilderExtensions`</Note>

#### 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend.                                                                                                                                                                                                   |
| `configSectionName` | `string`                                                                      | The name of the [ConfigurationSection](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.configurationsection) to load the [IndexedDbOptions](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/IndexedDb/Core/IndexedDbOptions) 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](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/IndexedDb/Core/IndexedDbOptions) inline.                                                                                   |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseKafkaMessagePublisher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_Kafka_IHostBuilderExtensions`</Note>

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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

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

#### Exceptions

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

#### Examples

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseKafkaMessagePublisher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Publish_Kafka_IHostBuilderExtensions`</Note>

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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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();
```

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseKafkaProcessor <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Dispatch_Kafka_IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to process messages from Apache Kafka and registers the [KafkaProcessor](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Kafka/KafkaProcessor) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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();
```

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseKafkaProcessor <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Dispatch_Kafka_IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to process messages from Apache Kafka and registers the [KafkaProcessor](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Kafka/KafkaProcessor) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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();
```

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseOrderedMessageDispatcher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use the [OrderedMessageDispatcher](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/OrderedMessageDispatcher), which processes registered [IMessageHandler](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessageHandler)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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseParallelMessageDispatcher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.IHostBuilderExtensions`</Note>

Configures SimpleMessageBus to use the [ParallelMessageDispatcher](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/ParallelMessageDispatcher), which processes registered [IMessageHandler](/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessageHandler)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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

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

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> UseSimpleMessageBusLifetime <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.Hosting.SimpleMessageBus_Hosting_IHostBuilderExtensions`</Note>

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](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) instance to extend. |

#### Returns

Type: `Microsoft.Extensions.Hosting.IHostBuilder`
The [IHostBuilder](/simplemessagebus/api-reference/Microsoft/Extensions/Hosting/IHostBuilder) 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.
