Java API Developer's Guide

The PubSub+ Messaging API for Java (version 1.5) uses modern interfaces, patterns, and usability in a native Java environment. The PubSub+ Java API offers many of the same features as the PubSub+ Messaging API for JCSMP, but requires minimal setup to provide a streamlined developer experience to develop client applications.

The PubSub+ Java API utilizes the builder pattern, which allows you to easily create a MessagingService object with a custom configuration that then connects to an event broker. After a successful connection is established, you can send and receive messages using other interfaces provided in the PubSub+ Java API. You can use the PubSub+ Java API to handle scenarios where messages accumulate on internal buffers, referred to as back-pressure. For example, on a client application that sends messages, it is possible to have a scenario where the client application is generating messages faster than the messages can be sent to the event broker, which can happen due to factors such as network congestion.

Here's an overview of how to use the PubSub+ Messaging API for Java after you've set-up your environment:

  1. Build the MessagingService object and configure it using properties to:
  2. Send messages to or receive messages from an event broker as follows using these objects:

    During the creation of the objects to publish or consume messages, you can configure how to handle when back-pressure occurs. See each section below for more information.

  3. As part of publishing or subscribing to messages, use OutboundMessage and InboundMessage objects, and handle errors as required via event handlers.

You can reference various sample applications to understand how to use the PubSub+ Java API. For more information, see Using the Java API Examples or review sections of this guide along with the PubSub+ Messaging API for Java reference.

Here's a short video that provides a brief overview of the PubSub+ Java API.