Using the Java Library

The Oracle Messaging Cloud Service Java SDK provides a Java library for managing service instance resources in addition to sending and receiving messages through the JMS API. Included in the Java SDK is a copy of the Javadocs for the Java library.

Topics:

Before you begin using the Java library, be sure to review the guidelines in this section as well as the general guidelines in Considerations When Developing Applications That Use Oracle Messaging Cloud Service.

Typical Workflow for Using the Java Library

To start using the Java library, refer to the following tasks as a guide:

Task Description More Information

Download the Oracle Messaging Cloud Service Java SDK

The Oracle Messaging Cloud Service Java SDK provides a Java library for managing service instance resources in addition to sending and receiving messages through the JMS API.

Downloading the Oracle Messaging Cloud Service Java SDK

Extract the Oracle Messaging Cloud Service Java library from the downloaded Java SDK

Extract the Java library JAR file somewhere onto your Java application's class path.

Package the Java library into an enterprise Java web application

Import the Java library's classes and interfaces into your Java application.

Create a Servlet or Web service

Create a Servlet or Web service to send and/or receive messages.

Accessing Oracle Messaging Cloud Service Using Java Library

Send a Message to a Topic

Create a standalone application

Create a Java standalone application to send and/or receive messages without an HTTP interface.

Accessing Oracle Messaging Cloud Service Using Java Library

Asynchronously Receive Messages with a Durable Subscription

Downloading the Oracle Messaging Cloud Service Java SDK

The Oracle Messaging Cloud Service Java SDK is a downloadable package that contains the following components:

Download the Oracle Messaging Cloud Service Java SDK from Oracle Technology Network at the following URL:

http://www.oracle.com/technetwork/topics/cloud/downloads/messaging-cloud-service-sdk-2279257.html

  • Java library (oracle.messaging.cloud.api-14.0.X.jar where X is the latest version number of the Java library)
  • Java API Reference documentation for Oracle Messaging Cloud Service

Authentication and Authorization

When using the Java library, a client is authenticated with Oracle Messaging Cloud Service when any of the operations listed below is initiated for the first time:

  • Using any destination management function (listing, creating, or deleting destinations).

  • Using a message push listener management function (listing, creating, or deleting message push listeners).

  • Listing durable subscriptions.

  • Creating a connection.

The MessagingService object is the entry point for all operations against an instance of Oracle Messaging Cloud Service, including message transmission and resource management. If only one MessagingService object is created for all operations, then all operations share the same user authentication and authorization level.

Differences from JMS

The Java library provided in Oracle Messaging Cloud Service implements the JMS 1.1 API. While you may be familiar with JMS in on-premises environments, note the following differences from JMS when using the Java library:

  • The Java Naming and Directory Interface (JNDI) is currently not supported for referencing JMS objects such as ConnectionFactory, Queue, and Topic. JMS objects must be instantiated directly using the Java library provided in Oracle Messaging Cloud Service. Since JNDI is not supported, Oracle Messaging Cloud Service cannot be used to implement message-driven beans.

  • Oracle Messaging Cloud Service does not enforce message priority on message delivery. Although message priority is a standard JMS message header, the implementation of priority headers is not mandated by the JMS specification. Messages can still be sent with a priority header but this does not influence how a message is delivered. The value of the priority header is set to the default value of "4".