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. |
|
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. |
|
Create a standalone application |
Create a Java standalone application to send and/or receive messages without an HTTP interface. |
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
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
, andTopic
. 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".