About Using the Java Library
Oracle Messaging Cloud Service can be accessed using the Java library.
Topics:
Prerequisites for Using the Java Library
The Oracle Messaging Cloud Service Java library provides all required Java Message Service (JMS) 1.1 functions, plus additional functions related to JMS and Oracle Messaging Cloud Service for sending and receiving messages through the JMS broker. Previous experience using JMS will be helpful.
The following are required to use the Oracle Messaging Cloud Service Java library:
-
An Oracle Messaging Cloud Service instance
-
The
oracle.cloud.messaging.api-14.0.X.jar
(whereX
is the number representing the latest version of the Java library) -
A Java Development Kit (JDK) of version 1.6 or greater
How to Use the Java Library
Before you begin using the Java library, be sure to review the following:
-
Considerations When Developing Applications That Use Oracle Messaging Cloud Service
- Check the Version of the Java Library
To use the Oracle Messaging Cloud Service Java library:
-
Download the Java library (see Downloading the Oracle Messaging Cloud Service Java SDK).
-
Add the jar file
oracle.messaging.cloud.api-14.0.X.jar
(whereX
is the latest version number of the Java library) to your Java application's class path. -
Import the Java library's classes and interfaces into your Java application.
import javax.jms.*; import oracle.cloud.messaging.*; import oracle.cloud.messaging.client.*; import oracle.cloud.messaging.common.*;
-
Create a
MessagingService
object.A
MessagingService
object is created from aMessagingServiceFactory
. When creating aMessagingService
object, aMessagingServiceNamespace
object and aMessagingServiceCredentials
object must be provided.For more information, see Creating a MessagingService Object.
How to Check the version of the Java Library
The Java library is delivered in two identical
.jar files — one containing the version number of the Java library
in the file name (for example, oracle.cloud.messaging.api-14.0.1.jar
,) and one without the version number (for example, oracle.cloud.messaging.api.jar
.) You can also obtain the information about the version of the Java
library after installation, through the class oracle.cloud.messaging.VersionInfo.
java -jar <jar
name>.
The version number of the Java library is displayed.
The manifest of each of the Java
library jars contains the version of the Java library as the Implementation-Version
attribute of the oracle.cloud.messaging
package.