This chapter provides an overview of Oracle User Messaging Service (UMS) APIs and it includes the following sections:
Oracle User Messaging Service (UMS) provides a common service responsible for sending out messages from applications to devices or services using various protocols. It also routes incoming messages from devices or services to applications.
To learn more about the architecture and features of Oracle User Messaging Service, see the "Introduction to Oracle User Messaging Service" chapter in Administering Oracle User Messaging Service.
Oracle Fusion Middleware application developers can either use the UMS Java API or the UMS Web Service API to implement messaging services in their applications. Use the UMS Java API if the application runs from the same JEE server as the UMS Messaging Engine. Otherwise, use the UMS Web Services API. In the case of Web Services API, the provided UMS client code wraps the actual Web Services calls and make use of the UMS Web Services API very similar to the UMS Java API.
For more information about the classes and interfaces, see User Messaging Service Java API Reference.
How does the UMS Java API work?
The UMS Client library consists of two main components, MessagingClient
and ListenerManager
. The MessagingClient
is created through the MessagingClientFactory
and it is the handle that the client uses to send and receive messages, to register AccessPoints
(represents the addresses an application uses for receiving messages), and to set listeners. Addresses
and AccessPoints
are created through the MessagingFactory
. The ListenerManager
handles the callbacks when the application wants to receive messages or status information asynchronously using listeners.
When a MessagingClient
is created, it registers the application in the user messaging engine and when a message or status arrives, the ListenerManager
calls the listener's onMessage
or onStatus
method.
The following code snippet illustrates how to create a Messaging client, how to register an access point, and how to send a message:
//Create MessagingClient HashMap<String, Object> clientParameters = new HashMap<String, Object>(); clientParameters.put(ApplicationInfo.APPLICATION_NAME, appName); MessagingClient messagingClient = MessagingClientFactory.createMessagingClient(clientParameters); //Create sender and recipient addresses Address sender = MessagingFactory.createAddress("EMAIL:alice@example.com"); Address recipient = MessagingFactory.createAddress("EMAIL:bob@example.com"); //Create and register an accessPoint for the Address(es) you want to be able to receive messages for. AccessPoint accessPoint = MessagingFactory.createAccessPoint(sender); messagingClient.registerAccessPoint(accessPoint); //Create and send a message Message message = MessagingFactory.createTextMessage("Hello World"); message.setSubject("Test Subject"); message.addRecipient(recipient); message.addSender(sender); String mid = messagingClient.send(message);
The Parlay X Multimedia Messaging API and the User Messaging Service EJB API are deprecated in this release. The UMS Java API replaces the deprecated EJB API and the UMS Web Services API replaces the deprecated Parlay X Multimedia Messaging API. See Chapter 2, "Sending and Receiving Messages using the User Messaging Service Java API" and Chapter 3, "Sending and Receiving Messages using the User Messaging Service Web Service API".
For more information about the deprecated APIs, see the Developer's Guide at:
The code samples for Oracle User Messaging Service are available on Oracle Technology Network at:
http://www.oracle.com/technetwork/indexes/samplecode/sample-ums-1454424.html
.
Note:
Unless explicitly identified as such, the sample codes are not certified or supported by Oracle; it is intended for educational or testing purposes only.You can build and deploy these sample applications using Oracle JDeveloper 12c, and also manage communication preferences through a web interface (see Administering User Communication Preferences).