---
schema_version: "1"
id: 1ad78d34e797e037ff67c06c4a5acd3a942692eff0c2b392c90e5a96d32fe969
title: "Step 2: Start the Managed Subscription"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/event-bus/pub-sub-api/guides/qs-java-managed-sub-start.md
canonical_url: https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-java-managed-sub-start.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9652cea0c39ec9dd2a96373ccd87afa7c131a50ffb95ab42e2bcde96addd30f8
products:
  - Pub/Sub API
  - Event Bus Docs
---
# Step 2: Start the Managed Subscription

Start a managed subscription by using the `ManagedSubscribe.java` class, which calls the `ManagedSubscribe` RPC method (beta).

1. Set up the Pub/Sub API Java client by following the steps in [Step 2: Build the Client](https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-java-build-client.md) in the main Java quick start.
2. Configure the required client parameters, such as your Salesforce org login URL and credentials, in `arguments.yaml` by following the steps in [Step 3: Configure Client Parameters](https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-java-parameters.md) in the main Java quick start.
3. In `arguments.yaml`, specify the managed subscription ID. In this case, you use the ID  `MANAGED_SUB_ID=18xKj000000000BIAQ`.
4. To run the `ManagedSubscribe` RPC example, enter `./run.sh genericpubsub.ManagedSubscribe`.

**important:** When you create a ManagedEventSubscription record, there can be a delay before the new configuration takes effect in Pub/Sub API. If the subscription returns an error saying that the managed subscription configuration isn’t found, wait several minutes and then restart it.

Because no events are published yet, the client doesn’t receive any events yet. In the next step, you publish some events.
