---
source_url: https://www.pubnub.com/docs/sdks/java/entities/channel-group
title: ChannelGroup Entity
updated_at: 2026-06-30T11:07:21.985Z
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


# ChannelGroup 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 ChannelGroup

Use this factory method to return a local `ChannelGroup` entity for a single channel group. A `ChannelGroup` entity centralizes operations—such as creating a subscription—so you can prototype and build faster.

```java
pubnub.channelGroup(String name)
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| name | String | Yes |  | Name of the [channel group](https://www.pubnub.com/docs/general/channels/subscribe#channel-groups) 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.ChannelGroup;

public class ChannelGroupApp {
    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 ChannelGroup entity
        ChannelGroup myChannelGroup = pubnub.channelGroup("myGroup");

        System.out.println("Channel Group created: " + myChannelGroup.getName());
    }
}
```

## Available operations

The `ChannelGroup` entity provides operations for PubNub [channel groups](https://www.pubnub.com/docs/general/channels/subscribe#channel-groups).

| 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 group [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 group. |