# Create Channel (/sdks/csharp/how-to/management/create-channel)



## Overview [#overview]

KubeMQ auto-creates a channel the first time a client publishes or subscribes to it — convenient for prototyping, but a liability once channels are infrastructure you need to reason about. Pre-creating channels with the management API lets you provision topology *before* any producer or consumer connects: enforce naming conventions in a startup script, stand up the channels a service depends on as part of deployment, or fail fast if a required channel is missing instead of it silently springing into existence.

`CreateChannelAsync(name, type)` registers a channel directly with the server, where `type` is one of `"events"`, `"events_store"`, `"queues"`, `"commands"`, or `"queries"`.

**Gotchas:** the call is idempotent for a matching name and type, so it's safe to call on every startup — but a channel's type is fixed at creation, and reusing the name with a *different* type fails rather than migrating it. Creation only registers the channel; it does not start a consumer, so a freshly created queue or events channel happily accepts messages with nothing yet reading them.

## Prerequisites [#prerequisites]

* KubeMQ server running on `localhost:50000`
* C# SDK installed (`dotnet add package KubeMQ.SDK.CSharp`)

## Code [#code]

```csharp title="Program.cs"
// KubeMQ .NET SDK — Management: Create Channel
//
// This example demonstrates creating a channel with the management API.
//
// Prerequisites:
//   - KubeMQ server running on localhost:50000
//   - dotnet run

using KubeMQ.Sdk.Client;

await using var client = new KubeMQClient(new KubeMQClientOptions
{
    ClientId = "csharp-config-channel-management-client",
});
await client.ConnectAsync();

Console.WriteLine("Connected to KubeMQ server");

await client.CreateChannelAsync("csharp-config.channel-management", "events");
Console.WriteLine("Channel 'csharp-config.channel-management' created.");

Console.WriteLine("Done.");

```

## How It Works [#how-it-works]

* `CreateChannelAsync(name, type)` registers the channel on the server; `type` must match one of the KubeMQ channel types: `"events"`, `"events_store"`, `"queues"`, `"commands"`, or `"queries"`.
* Creating the same channel name twice is idempotent; the server returns success without error.
* Creation only registers the channel — use [List Channels](/sdks/csharp/how-to/management/list-channels) to confirm it exists, or [Delete Channel](/sdks/csharp/how-to/management/delete-channel) to remove it.

## Related [#related]

* [C# SDK Reference](/sdks/csharp/reference)
* [Delete Channel](/sdks/csharp/how-to/management/delete-channel)
* [List Channels](/sdks/csharp/how-to/management/list-channels)
