Step 3: Configure Client Parameters
The Java client example contains parameters that are passed to the client. Enter values for the required parameters such as the Pub/Sub API endpoint and your Salesforce login credentials. Optional parameters have default values, so provide values only if you want to change the defaults.
- In your cloned repo, navigate to
src/main/resources
and open thearguments.yaml
file. - Enter the required parameters that are used to establish the streaming connection.
- PUBSUB_HOST: Specify the Pub/Sub API endpoint
api.pubsub.salesforce.com
. - PUBSUB_PORT: Specify the Pub/Sub API port to be used,
7443
or443
. - LOGIN_URL: Specify the login URL of the Salesforce org to use to run the examples, starting with
https://
. For login URL formats, see My Domain URL Formats in Salesforce Help. - USERNAME and PASSWORD: To authenticate via username and password, specify the Salesforce username and password.
- ACCESS_TOKEN and TENANT_ID: For authentication via session token a tenant ID, specify the sessionToken and tenant ID of the Salesforce org.
Optional Parameters
For the optional parameters, don't provide any values so that the default values are used. Here is a description of the optional parameters:
- TOPIC: This parameter is the topic for publishing and subscription. The default value is
/event/CarMaintenance__e
. - NUMBER_OF_EVENTS_TO_PUBLISH: This parameter is the number of events to publish while using the Publish or PublishStream RPC. The default value is 5.
- NUMBER_OF_EVENTS_TO_SUBSCRIBE: This parameter is the number of events that the Subscribe RPC requests from the server in each FetchRequest. The default value is 100.
- REPLAY_PRESET: This parameter specifies where to start the subscription. To fetch past events that are stored in the event bus, use REPLAY_PRESET with REPLAY_ID. For more information, see the Readme page in the pub-sub-api GitHub repository and Replaying an Event Stream in the Pub/Sub API documentation.