---
source_url: https://www.pubnub.com/docs/sdks/java/entities/channel-metadata
title: ChannelMetadata Entity
updated_at: 2026-06-12T11:25:28.738Z
sdk_name: PubNub Java SDK
sdk_version: 6.4.5
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# ChannelMetadata Entity

PubNub Java SDK, use the latest version: 6.4.5

Install:

```bash
Add PubNub dependency to your build@6.4.5
```

As of version 9.0.0, the Java software development kit (SDK) supports entities. Entities are SDK objects that bundle operations for a specific resource type and simplify working with PubNub application programming interfaces (APIs).

Use entities to perform common tasks without manually wiring requests. Some PubNub APIs are exposed via entities. Other operations remain available on the `pubnub` object.

## Create ChannelMetadata

Use this factory method to return a local `ChannelMetadata` entity for a single channel metadata object. A `ChannelMetadata` entity centralizes operations related to App Context channel metadata.

```java
pubnub.channelMetadata(String id)
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| id | String | Yes |  | Identifier of the [channel metadata](https://www.pubnub.com/docs/general/metadata/channel-metadata) for which to create the entity. |

#### Sample code

:::tip Reference code
This example is a self-contained code snippet ready to be run. It includes necessary imports and executes methods with console logging. Use it as a reference when working with other examples in this document.
:::

```java
import com.pubnub.api.PubNubException;
import com.pubnub.api.java.PubNub;
import com.pubnub.api.java.v2.PNConfiguration;
import com.pubnub.api.UserId;
import com.pubnub.api.java.v2.entities.ChannelMetadata;

public class ChannelMetadataApp {
    public static void main(String[] args) throws PubNubException {
        // Configure PubNub instance
        PNConfiguration.Builder configBuilder = PNConfiguration.builder(new UserId("demoUserId"), "demo");
        configBuilder.publishKey("demo");
        configBuilder.secure(true);

        PubNub pubnub = PubNub.create(configBuilder.build());

        // Create a ChannelMetadata entity
        ChannelMetadata metadata = pubnub.channelMetadata("myChannel");

        System.out.println("Channel Metadata created: " + metadata.getId());
    }
}
```

## Available operations

The `ChannelMetadata` entity provides operations for PubNub App Context [channel metadata](https://www.pubnub.com/docs/general/metadata/channel-metadata).

| Operation (click for more information) | Description |
| --- | --- |
| [subscription(subscriptionOptions)](https://www.pubnub.com/docs/sdks/java/api-reference/publish-and-subscribe#subscribe) | Returns a local channel metadata [subscription object](https://www.pubnub.com/docs/general/channels/subscribe#subscription-types) with [optional parameters](https://www.pubnub.com/docs/general/channels/subscribe#subscription-options). You can then subscribe to receive real-time updates for that channel metadata. |