Newer Version Available

This content describes an older version of this product. View Latest

Example: Subscribe to and Replay Events Using a Java Client

This code example implements Streaming API from a Java client using a library called EMP Connector. The connector hides the complexity of creating a CometD client and subscribing to Streaming API in Java. The example subscribes to a channel, receives notifications, and supports replaying events with durable streaming.

EMP Connector is based on Java 8 and uses CometD version 3.0.9. The connector supports PushTopic and generic streaming. It also supports username and password authentication and OAuth bearer token authentication.

The example requires API version 37.0 or later. For a code example that supports earlier API versions, refer to an earlier version of this documentation.

Note