# Delete Channel (/sdks/rust/how-to/management/delete-channel)



## Overview [#overview]

Deleting a channel is how you decommission a topic, queue, or RPC endpoint you no longer need — tearing down test fixtures between CI runs, retiring a deprecated integration, or cleaning up the throwaway channels a demo or load test created. It's a permanent, immediate operation: the channel's routing entry is removed from the broker and any messages still sitting in it are discarded, so it's not something you want triggered by a typo in a shared environment.

Under the hood, the client exposes one delete method per channel type — `delete_events_channel`, `delete_events_store_channel`, `delete_commands_channel`, `delete_queries_channel`, and `delete_queues_channel` — each taking just the channel name. Because channels are namespaced by type, an events channel and a queues channel can share the same name without colliding, and deleting one never touches the other.

**Gotchas:** deleting a channel that doesn't exist fails with a `Fatal` error rather than succeeding silently, so call `list_channels` first if you need to confirm a channel exists before deleting it, or wrap the call to tolerate the not-found case. There's no "soft delete" or recovery window — any messages still queued are gone with it. And running this against a shared environment with the wrong channel name or client ID can silently remove a channel other services still depend on, so double-check before running.

## Prerequisites [#prerequisites]

* KubeMQ server running on `localhost:50000`
* Rust SDK installed (`cargo add kubemq`)

## Code [#code]

```rust title="main.rs"
use kubemq::prelude::*;

#[tokio::main]
async fn main() -> kubemq::Result<()> {
    let client = KubemqClient::builder()
        .host("localhost")
        .port(50000)
        .build()
        .await?;

    client.delete_events_channel("example-events-ch").await?;
    client.delete_events_store_channel("example-store-ch").await?;
    client.delete_commands_channel("example-commands-ch").await?;
    client.delete_queries_channel("example-queries-ch").await?;
    client.delete_queues_channel("example-queues-ch").await?;

    println!("All example channels deleted");

    client.close().await?;
    Ok(())
}
```

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

* Delete operations fail with a `Fatal` error if the channel does not exist.
* Use `list_channels` first to verify a channel exists before deleting.
* Review timeouts, channel names, and client IDs before running against shared environments.
* Run the program while the server from the prerequisites is available.

## Related [#related]

* [Rust SDK Reference](/sdks/rust/reference/client)
* [Create Channel](/sdks/rust/how-to/management/create-channel)
