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 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 in the main Java quick start.
  3. In arguments.yaml, specify the managed subscription developer name or ID. In this case, you use the developer name MANAGED_SUB_DEVELOPER_NAME=My_Managed_Subscription.
  4. To run the ManagedSubscribe RPC example, enter ./run.sh genericpubsub.ManagedSubscribe.

When you create a ManagedEventSuscription, 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 a little while 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.