Message Transmission API
The Message Transmission API provides an interface for sending messages through producers and receiving messages through consumers, including advanced messaging capabilities such as transactions. The Message Transmission API also provides functionality to create and manage messaging contexts, connections, sessions, durable subscriptions, temporary destinations, and queue browsers.
Topics:
Creating and Managing Messaging Contexts
This section provides information about creating and managing messaging contexts in Oracle Messaging Cloud Service.
Topics:
Create a Messaging Context
A messaging context is a container of ephemeral objects like connections, sessions, producers, consumers, temporary destinations, and queue browsers.
Creation of a messaging context is an implicit operation. It is created by the first access to the Oracle Messaging Cloud Service that passes authentication. At least one messaging context must be created by a client in order to access Oracle Messaging Cloud Service. When a new messaging context is created, the HTTP response includes the header X-OC-NEW-MESSAGING-CONTEXT: true
. Existing messaging contexts are identified in HTTP requests by JSESSIONID
cookies. If an HTTP request does not include a JSESSIONID
cookie, or if the HTTP request includes a JSESSIONID
cookie for an expired messaging context, then a new messaging context is created. For more information about messaging contexts, see Messaging Context and HTTP Cookies.
Each messaging context created by the REST API has a maximum inactive interval (MII) associated with it. A messaging context expires if it is not accessed for a period of time longer than the associated MII.
Get Maximum Inactive Interval (MII)
This section provides information about getting the maximum MII allowed to be set by the service or service instance.
Method: GET
Path: /maxInactiveInterval
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Returns the information of the current MII and the maximum allowed MII.
Response Headers:
-
X-OC-MII:
positive integer number of seconds
Indicates the current value of the MII.
-
X-OC-MAX-MII:
positive integer number of seconds
Indicates the maximum MII allowed to be set by the service or service instance.
Error Response:
Error Message | Description |
---|---|
|
A low-level exception occurred in attempting to obtain the client ID. |
Set Maximum Inactive Interval (MII)
This section provides information about setting the Maximum Inactive Interval (MII).
Method: POST
Path: /maxInactiveInterval
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameter:
Parameter | Description |
---|---|
|
The value must be a non-negative integer, interpreted as the number of seconds to which the client would like to set the MII. |
Result: If the value of mii
in the request is positive, then the MII is set to that value (or 900 if the value is greater than 900). If it is 0, the messaging context expires immediately, and is deleted.
Note:
A value of 0 does not indicate infinity. Clients may not set messaging contexts to never expire.
Response Headers:
-
X-OC-MII:
positive integer number of seconds
If the requested MII was positive, this is the new value of the maximum inactive interval, which may be less than the value submitted. The maximum is 900 seconds.
-
X-OC-MAX-MII:
positive integer number of seconds
Indicates the maximum MII allowed to be set by the service or service instance. The maximum MII allowed is 900 seconds.
Error Responses:
Error Message | Description |
---|---|
|
The value of the |
|
A low-level exception occurred. |
Creating and Managing Connections
A client can associate a client ID with a connection. The client ID is a string that, along with a subscription name, identifies a durable subscription to a topic. When creating a durable consumer on a topic, the client ID set on the connection is used with the subscription name supplied in the consumer creation method to identify the durable subscription.
An attempt to set the client ID on a connection that generates an error with InvalidClientIDException
as its exceptionClass
causes the connection to become unusable. Any connection on which such an error response is received should be closed.
Topics:
Create a Connection
This topic provides information about creating a connection.
Method: PUT
Path: /connections/
connectionName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameters:
Parameter | Description |
---|---|
|
Optional. The value is the client ID that the client would like to set on the connection. |
|
Optional. To start a connection, value of the |
Result: Creates a connection with the name connectionName
. A connection is stopped when it is created (unless the start
action is specified in the PUT
request to create the connection).
Response Body:
The response body in XML for creating a connection is as follows:
<connection>
<metadata>
<JMSXPropertyNames>
<items>JMSXDeliveryCount</items>
<items>JMSXGroupID</items>
<items>JMSXGroupSeq</items>
</JMSXPropertyNames>
</metadata>
<canonicalLink>relative path to newly created connection</canonicalLink>
</connection>
Each supported JMSX property name is listed in an <items>
element.
The response body in JSON for creating a connection is as follows:
{
"metadata":
{
"JMSXPropertyNames":
[
"JMSXDeliveryCount",
"JMSXGroupID",
"JMSXGroupSeq"
]
}
"canonicalLink": "relative path to newly created connection"
}
For more information, refer to the following links:
Error Responses:
Error Message | Description |
---|---|
|
The value that is provided for the connection's client ID is rejected by the JMS provider. |
|
A connection with the specified name already exists. |
|
An internal error has occurred in determining the number of connections that a service instance is allowed. |
|
The service instance has exceeded the number of connections it can create on a single virtual machine in the cloud. This usually means that the service instance has reached, or even gone beyond, the maximum number of allowed connections. |
|
A low-level exception occurred in attempting to obtain the client ID. |
Update Connection Properties
This section provides information about updating connection properties.
Method: POST
Path: /connections/
connectionName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameters:
Parameter | Description |
---|---|
|
Optional. The value is the client ID that the client would like to set on the connection. |
|
Optional. To start a connection, value of the |
Result: If the clientId
parameter is present, the client ID of the connection is set to the specified value, provided that none of the following blocking conditions are true:
-
The client ID has already been set to a value for the connection.
-
The connection was started when it was created.
-
The connection has been used for any operation.
-
The client ID is in use by some other application.
If any of the blocking conditions is true, a 400 error response is generated.
Note:
If a REST API client sets a client ID on a connection, as long as that connection exists, no other connection will be able to have the same client ID set on it. As a consequence, no other connection will be able to create, delete, or consume from any durable subscription with that client ID. For example, consider the following situations:
-
A client fails, or otherwise loses the value of the
JSESSIONID
HTTP cookie that identifies the messaging context that contains a connection with a client ID. -
A client exits without either deleting a connection with a client ID or expiring the messaging context containing it by setting the messaging context's MII to 0.
In either of these cases, no client will be able to create a new connection with the given client ID until the messaging context expires. To avoid these situations, a REST API client that sets a client ID on a connection should do the following:
-
Set the MII of any messaging context containing a connection with a client ID to the smallest feasible value, so that, if the client fails or loses the value of the
JSESSIONID
HTTP cookie, the time before the client ID can be used again is minimal. -
Delete connections with client IDs before exiting, either by explicitly performing a
DELETE
on the connection resource or by setting the MII of the messaging context containing such connections to 0, which will close all connections in the context.
Error Responses:
Error Message | Description |
---|---|
|
The value that is provided for the connection's client ID is rejected by the JMS provider. The value of the clientId may be in use by another application, including message push listeners. |
|
The requested connection does not exist. |
|
An attempt was made to set the client ID on a connection on which it cannot be set, either because it has already been set or because an operation has been performed (for example, starting the connection, or creating a session) after which the client ID can no longer be set. |
|
A low-level exception occurred in attempting to obtain the client ID, or its value has been rejected. |
Delete a Connection
This topic provides information about deleting a connection.
Method: DELETE
Path: /connections/
connectionName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Closes and deletes the connection. This also closes and deletes all sessions, producers, consumers, temporary destinations, and queue browsers created with the connection.
Error Response:
Error Message | Description |
---|---|
|
The requested connection does not exist. |
Creating and Managing Sessions
Before messages can be sent or received through the Message Transmission API, a connection and a session must be created. A session provides a behavioral context that defines what it means for messages to be sent and received between clients and Oracle Messaging Cloud Service.
Topics:
Create a Session
This topic provides information about creating a session.
Method: PUT
Path: /sessions/
sessionName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameters:
Parameter | Description |
---|---|
|
Specify the name of the connection used to create the session. |
|
Optional. If present, must have value |
|
Optional. If present, must have value |
Result: Creates a session.
Error Responses:
Error Message | Description |
---|---|
|
The |
|
The value of the |
|
A session with the given name already exists. |
|
No connection exists with name which is specified for the |
|
A low-level exception was thrown in creating the session. |
Acknowledge, Commit, Rollback, or Recover a Session
This topic provides information about acknowledging, committing, doing a rollback, or recovering a session.
Method: POST
Path: /sessions/
sessionName
/state
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameter:
Parameter | Description |
---|---|
|
Required. Must have value |
Result: Performs the specified operation. If the action is acknowledge
or recover
, and the session is set to acknowledge messages automatically (either with acknowledgement mode auto
or dups_ok
), this is a no-op. If the action is commit
or rollback
, and the session is not transacted, this is a no-op. If the action is recover
and the session is transacted, a 500 error response is generated.
See Process Messages using a Transaction for an example HTTP request/response sequence.
Error Responses:
Error Message | Description |
---|---|
|
The |
|
The value of the action parameter was not |
|
There is no session with the specified name. |
|
A low-level exception was thrown while attempting to carry out the specified action on the specified session. |
Delete a Durable Subscription
This topic provides information about deleting a durable subscription.
Method: DELETE
Path: /sessions/
sessionName
/subscriptions/
subscriptionName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Deletes the subscription whose client ID is that set on the connection and whose name is that given on the path.
Error Responses:
Error Message | Description |
---|---|
|
Session specified on the path does not exist. |
|
The subscription has a consumer on it. |
|
Subscription specified on the path does not exist. |
|
A low-level exception was thrown while attempting to delete the subscription. |
Close and Delete a Session
This topic provides information about closing and deleting a session.
Method: DELETE
Path: /sessions/
sessionName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Session with name sessionName is closed and deleted. All producers, consumers, and queue browsers associated with the session are implicitly closed and deleted.
Error Responses:
Error Message | Description |
---|---|
|
There is no session with the specified name. |
|
A low-level exception was thrown while attempting to close and delete the specified session. |
Sending Messages
This section provides information about sending messages using the REST API.
Topics:
See Send a Message to a Topic for example HTTP requests which send a message to a destination.
Create a Producer
This topic provides information about creating a producer.
Method: PUT
Path: /producers/
producerName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameters:
Parameter | Description |
---|---|
|
Required. The value is the name of the session in which to create the producer. |
|
Optional. If present, the value must have one of the following forms:
Specifies the default destination of messages sent via the producer. If this parameter is omitted, then the destination to which a message is sent must be specified as a parameter in each send operation performed via this producer. |
|
Optional. If present, the value must be Note: The value of this parameter is a hint to the service, which may disregard the value. |
|
Optional. If present, the value must be |
|
Optional. If present, the value must be a strictly positive long integer or the value |
Result: Creates a producer.
Error Responses:
Error Message | Description |
---|---|
|
The |
|
One of the following occurred:
|
|
Session by which to create the producer does not exist. |
|
The default destination specified for the producer does not exist. |
|
There is already a producer with the specified name. |
|
The |
|
A low-level exception was thrown while attempting to create the producer. |
Set Properties of a Producer
This section provides information about setting properties of a producer.
Method: POST
Path: /producers/
producerName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameters:
Parameter | Description |
---|---|
|
Optional. If present, the value must be Note: The value of this parameter is a hint to the service, which may disregard the value. |
|
Optional. If present, the value must be |
|
Optional. If present, the value must be a strictly positive long integer or the value |
Result: Sets the property associated with the parameter to the specified value for all parameters present.
Error Responses:
Error Message | Description |
---|---|
|
One of the following occurred:
|
|
The specified producer to modify does not exist. |
|
The |
|
A low-level exception was thrown while attempting to modify the producer. |
Close and Delete a Producer
This topic provides information about closing and deleting a producer.
Method: DELETE
Path: /producers/
producerName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Closes and deletes the producer with name producerName.
Error Responses:
Error Message | Description |
---|---|
|
The specified producer to close and delete does not exist. |
|
A low-level exception was thrown while attempting to close and delete the producer. |
Send a Message via a Producer
This section provides information about sending a message via a producer.
Method: POST
Path: /producers/
producerName
/messages
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Sends the message specified by the HTTP headers and request body to the destination specified as described below.
Request parameters, headers, and the request body are as described in Properties of HTTP Requests to Send Messages from REST Clients, with the following differences in the request parameters:
Parameter | Description |
---|---|
|
The default value of this header is defined by the producer. |
|
The default value of this header is defined by the producer. |
|
Required if the producer was not created with a destination, in which case the message is sent to the specified destination. If present, must have one of the following forms:
Forbidden if the producer was created with a destination, in which case the message is sent to the destination with which the producer was created. |
|
Optional. This parameter is used to set the Note:
|
|
Optional. This parameter is used to set the Note that this parameter is optional, but should be set if, and only if, |
Response Headers:
Header | Description |
---|---|
|
One of the following values is set for this header:
|
|
|
|
|
|
|
|
|
|
This is always the default value, |
Error Responses:
Error Message | Description |
---|---|
|
One of the following occurred:
|
|
An |
|
The |
|
Either the producer has no default destination and no destination was specified by the request, or the producer has a default destination and a destination was specified by the request. |
|
The destination specified for the message does not exist. |
|
The specified producer by which to send the message does not exist. |
|
The request's message-relevant headers exceeded the maximum size. |
|
The request's body exceeded the maximum size. |
|
The |
|
The service instance already has the maximum number of messages on the specified destination of the message. |
|
The message could not be sent because the targeted destination reached the hard quota on the number of bytes of messages on it, and has not yet fallen below its soft quota. For more information, see Hard and Soft Quotas. |
|
The server was unable to obtain the input stream containing the message body, or a low-level exception was thrown by the JMS broker in trying to send the message. |
Receiving Messages
This section provides information about receiving messages using REST API.
Topics:
Create a Consumer
This topic provides information about creating a consumer.
Method: PUT
Path: /consumers/
consumerName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameters:
Parameter | Description |
---|---|
|
Required. The value is the name of the session in which to create the consumer. |
|
Optional. If present, the value must have one of the following forms:
Specifies the destination from which the consumer consumes messages. If the |
|
Optional. Specifies the subset of messages the consumer will receive. The value of the parameter must be a selector. For the syntax of selectors, see the Message Selectors section of the Java API reference for the |
|
Optional. If present, value must be |
|
Optional. Specifies the name of the durable subscription. If present, the consumer created will be a durable topic subscriber (and so the |
Result: Creates a consumer. If the destination
parameter is present and it specifies a queue, then the consumer will consume from the queue. If the destination
parameter is present and it specifies a topic, then the consumer will consume from the topic.
Note:
If the subscriptionName
parameter is present, then the exact result depends significantly on whether the destination
parameter is present or not.
If the destination
parameter is present, a consumer is created with characteristics given by the other parameters, as follows:
-
If the
destination
specifies a topic, the client ID has been set for the connection andsubscriptionName
is present, then the consumer will consume messages via a durable subscription to the topic specified by the client ID and the subscription name. -
If no durable subscription with the given client ID and name exists, one is created on the specified topic with the specified selector.
-
If a durable subscription for the ID and name already exists, and the topic and selector are the same as in the method that created the durable subscription, the existing durable subscription is used (and, thus, any messages sent to the topic since the subscription was created that have not been consumed through the subscription is available to be consumed).
-
If a durable subscription for the ID and name already exists, but either the topic or the selector (or lack thereof) specified in this method are different from the topic and selector (or lack thereof) specified in the method that created the existing subscription, the existing subscription is deleted, and messages saved by it discarded, and a new durable subscription with the specified ID, name and selector on the specified topic is created.
If the destination
parameter is not present, the client ID must have been set on the connection, the subscriptionName
parameter must be present, the selector
parameter must not be present, and there must be an existing durable subscription with the given client ID and subscription name. (The semantics of localMode
are unchanged.) In this case, the consumer created is a consumer on the topic for the existing subscription, with the selector (or lack thereof) of the existing subscription, that uses the existing subscription. In this case, the method will not create or delete a subscription.
Response Headers:
Response to creating a consumer on an existing durable subscription contains the following headers that provide the properties of the subscriber:
-
X-OC-DESTINATION
Indicates the topic of the subscription.
-
X-OC-SELECTOR
Indicates the selector of the subscription, if any.
Error Responses:
Error Message | Description |
---|---|
|
The |
|
One of the following occurred:
|
|
Neither a destination nor a subscription name were supplied. |
|
The |
|
An attempt was made to create a consumer on a durable subscription when that durable subscription already has a consumer on it. |
|
Subscription name and destination parameters were supplied, but the |
|
Session by which to create the producer does not exist. |
|
The destination from which the consumer should get messages is nonexistent. |
|
There is already a consumer with the given name. |
|
The method did not supply a |
|
The consumer whose creation was attempted was on a durable subscription that does not currently exist, and this method invocation would create the subscription if it does not exist, and the service instance is at its maximum number of durable subscriptions. |
|
The method did not supply a |
Close and Delete a Consumer
This topic provides information about closing and deleting a consumer.
Method: DELETE
Path: /consumers/
consumerName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Closes and deletes the consumer.
Error Responses:
Error Message | Description |
---|---|
|
The specified consumer to close does not exist. |
|
A low-level exception was thrown while closing and deleting the specified consumer. |
Receive a Message via a Consumer
This section provides information about receiving a message via a consumer.
Method: POST
Path: /consumers/
consumerName
/messages
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameter:
Parameter | Description |
---|---|
|
Required. The number of milliseconds in the value must be a strictly positive long integer that is no more than the maximum receive timeout of 5 minutes. Specifies the amount of time in milliseconds to wait for a message to become available from the consumer before returning a null message. |
See Receive a Message from a Queue with a Selector and Receive a Message from a Durable Subscription for examples of HTTP request/response sequences.
Result:
-
If there is a message on the consumer's queue that satisfies the selector (if it was set on the consumer), or if one enters the queue within the number of milliseconds in
timeout
, it is returned in the HTTP response. Otherwise, a null response is returned. -
If receiving from a topic, if messages have been published to the topic since the consumer was created, or if messages are published to the topic within the number of milliseconds in
timeout
, one of those messages will be return in the HTTP response. Otherwise, a null response is returned. -
If the consumer is consuming from a durable subscription, and if there is a message currently stored in the durable subscription, or if one enters the durable subscription within the number of milliseconds in
timeout
, it is returned in the HTTP response. Otherwise, a null response is returned.
Note:
If the session by which the consumer was created is transacted, or is not transacted but has client acknowledgement set, only one message may be received via that consumer before committing (if the session is transacted) or acknowledging (if the session is not transacted but has client acknowledgement set) the session. Until the appropriate commit or acknowledgement action is taken, receives from that consumer will return a null response, even if there are other messages that could otherwise be received from the consumer's destination.
Response Headers: If a message is returned, the headers will include those determined by the message described in Properties of HTTP Requests and Responses that Deliver Messages. Otherwise, a response with no content with the header X-OC-NULL: true
is returned.
Error Responses:
Error Message | Description |
---|---|
|
The request had no |
|
The value of the |
|
The specified consumer from which to receive does not exist. |
|
The value of the |
|
A low-level exception was thrown while receiving, or an exception was thrown while attempting to extract information from the received message. |
Creating and Managing Durable Subscriptions
This section provides information about creating and managing durable subscriptions in Oracle Messaging Cloud Service.
Topics:
Create a Durable Subscription
Durable subscriptions are implicitly created by creating a special type of consumer.
To create a durable subscription, see the Create a Consumer section, specifically the notes about subscriptionName
and clientId
.
List Durable Subscriptions
This section provides information about listing durable subscriptions.
Method: GET
Path: /subscriptions
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameters:
Parameter | Description |
---|---|
|
The name of the subscription. |
|
The name of a topic. Note that the value of this parameter is not of the form |
|
A client ID associated with the subscription. |
None of these parameters are mandatory, but only certain combinations are allowed, as described below.
Result: Returns information about one or more durable subscriptions depending on the request parameters supplied:
-
clientId
andsubscriptionName
Returns an XML or a JSON document specifying the unique durable subscription for the given name and client ID, if one exists, for the namespace specified in the request.
The XML format is as follows:
<subscription> <clientId>client ID<clientId> <name>subscription name</name> <topic>topic name</topic> <selector>selector</selector> <canonicalLink>relative path to the subscription</canonicalLink> </subscription>
The JSON format is as follows:
{ "clientId": "client ID", "name": "subscription name", "topic": "topic name", "selector": "selector", "canonicalLink": "relative path to the subscription" }
All child elements will be present except
selector
, which is present if the subscription is associated with a selector. TheclientId
andname
elements always have the same values as the corresponding parameters. -
clientId
Returns an XML or a JSON document specifying all of the durable subscriptions for the given client ID for the namespace specified in the request.
The XML format is as follows:
<subscriptions> <items> <clientId>client ID<clientId> <name>name</name> <topic>topic name</topic> <selector>selector</selector> <canonicalLink>relative path to the subscription</canonicalLink> </items> ... <canonicalLink>relative path to the subscription list</canonicalLink> </subscriptions>
The JSON format is as follows:
{ "subscriptions": { "clientId": "client ID", "name": "subscription name" "topic": "topic name", "selector": "selector", "canonicalLink": "relative path to the subscription" } "canonicalLink": "relative path to the subscription list" }
This element may be empty if the client ID has no subscriptions. Each child specifies a unique durable subscription. The client ID of all
subscription
elements is the same as the value of the corresponding request parameter; each value of name will appear only once, as a durable subscription is specified by the client ID and subscription name. -
topicName
Returns an XML or a JSON document specifying all of the durable subscriptions for the topic with the given name for the namespace specified in the request. Note that the value of this parameter is not of the form
/topics/
name
, but is only thename
part of that form, since durable subscriptions only apply to topics. The format of the XML document in the response is the same as the XML format described earlier forclientId
. This element may be empty if the topic has no subscriptions. Each child specifies a unique durable subscription. Thetopic>
content of allsubscription
elements is the same as the value of the corresponding request parameter; each pair of values for client ID and name will appear only once, as a durable subscription is specified by the client ID and subscription name. -
None of the parameters are supplied
Returns an XML or a JSON document specifying all of the durable subscriptions for the namespace specified in the request. The format is the same as described earlier for
clientId
andsubscriptionName
,clientId
, andtopicName
. This element may be empty if the namespace has no durable subscriptions. Each child specifies a unique durable subscription. The topic values of allsubscription
elements is the same as the value of the corresponding request parameter; each pair of values for client ID and name will appear only once, as a durable subscription is specified by the client ID and subscription name.
Error Responses:
Error Message | Description |
---|---|
|
A combination of the |
|
The |
|
A client ID and subscription name were specified in the request, but no such subscription exists. |
|
A low-level exception occurred. |
Delete a Durable Subscription
Durable subscriptions are implicitly created by creating a special type of consumer. A durable subscription stores all messages sent to a topic until each message is received.
For information about deleting durable subscriptions through sessions, see Delete a Durable Subscription.
Creating and Managing Temporary Destinations
This section provides information about creating and managing temporary destinations in Oracle Messaging Cloud Service.
Topics:
Create a Temporary Destination
You can create the following kinds of temporary destinations:
-
Temporary Queue: A TemporaryQueue is a unique Queue object created for the duration of a connection. Messages may only be consumed from a temporary queue through the connection with which it was created.
-
Temporary Topic: A TemporaryTopic is a unique Topic object created for the duration of a connection. Messages may only be consumed from a temporary topic through the connection with which it was created.
Method: POST
Path:
-
To create a temporary queue, the path is
/temporaryQueues
-
To create a temporary topic, the path is
/temporaryTopics
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameter:
Parameter | Description |
---|---|
|
Specify the session name. This parameter is mandatory. |
Result: Creates a temporary queue or temporary topic.
Response Header:
Location
Contains the URL for the newly created temporary queue or temporary topic.
Response Body:
Destination Type | XML Format | JSON Format |
---|---|---|
Temporary queue |
<temporaryQueue> <name>queue name</name> <connection>name of the connection with which the queue is associated</connection> <canonicalLink>relative path to temporary queue</canonicalLink> </temporaryQueue> |
{ "type": "temporaryQueue", "name" "queue name", "connection": "name of the connection with which the queue is associated", "canonicalLink": "relative path to temporary queue" } |
Temporary topic |
<temporaryTopic> <name>topic name</name> <connection>name of the connection with which the topic is associated</connection> <canonicalLink>relative path to temporary topic</canonicalLink> </temporaryTopic> |
{ "type": "temporaryTopic", "name" "topic name", "connection": "name of the connection with which the topic is associated", "canonicalLink": "relative path to temporary topic" } |
Temporary queues |
<temporaryQueues> <name>queue name</name> <connection>name of the connection with which the queue is associated</connection> <canonicalLink>relative path to temporary queue</canonicalLink> ... <canonicalLink>relative path to list of temporary queues</canonicalLink> </temporaryQueues> |
{ "temporaryQueues": [ { "name": "queue name", "connection": "name of the connection with which the queue is associated", "canonicalLink": "relative path to temporary queue" } ... ], "canonicalLink": "relative path to list of temporary queues" } |
Temporary topics |
<temporaryTopics> <name>topic name</name> <connection>name of the connection with which the topic is associated</connection> <canonicalLink>relative path to temporary topic</canonicalLink> ... <canonicalLink>relative path to list of temporary topics</canonicalLink> </temporaryTopics> |
{ "temporaryTopics": [ { "name": "topic name", "connection": "name of the connection with which the topic is associated", "canonicalLink": "relative path to temporary topic" } ... ], "canonicalLink": "relative path to list of temporary topics" } |
The content of the name
field is a pseudorandom name generated by the service for the newly created temporary queue or topic.
The connection
field is omitted if the destination was not created from a connection in the messaging context.
Error Response:
Error Message | Description |
---|---|
|
A session with the specified name does not exists. |
List Temporary Destinations
This section provides information about listing temporary destinations.
List Temporary Queues or Temporary Topics
Method: GET
Path:
-
To list all temporary queues in the messaging context, the path is
/temporaryQueues
-
To list all temporary topics in the messaging context, the path is
/temporaryTopics
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameter:
Parameter | Description |
---|---|
|
Optional. Specify the |
Result: Returns a listing of all temporary queues or temporary topics in the messaging context.
Response Body:
In XML, the format for listing all temporary queues associated with an HTTP cookie is as follows:
<temporaryQueues> <items> <name>queue name</name> <connection>name of the connection with which the queue is associated</connection> <canonicalLink>relative path to temporary queue</canonicalLink> </items> ... <canonicalLink>relative path to list of temporary queues</canonicalLink> </temporaryQueues>
In XML, the format for listing all temporary topics associated with an HTTP cookie is as follows:
<temporaryTopics> <items> <name>topic name</name> <connection>name of the connection with which the topic is associated</connection> <canonicalLink>relative path to temporary topic</canonicalLink> </items> ... <canonicalLink>relative path to list of temporary topics</canonicalLink> </temporaryTopics>
The content of the <name>
element is the queueName
or topicName
.The <connection>
element is present only if the temporary queue or topic was created from a connection associated with the client's messaging context.
If the temporary queue or topic was created elsewhere and received as, for example, in the Reply-To
header of a message, then the <connection>
element will not be present.
Error Response:
Error Message | Description |
---|---|
connectionParameterNotFound |
A REST API client invoked the method to list all temporary destinations created through a certain named connection, but no connection with that name exists in the messaging context. |
Retrieve Properties of a Single Temporary Queue or a Single Temporary Topic
Method: GET
Path:
-
To retrieve the properties of a single temporary queue, the path is
/temporaryQueues/
queueName
-
To retrieve the properties a single temporary topic, the path is
/temporaryTopics/
topicName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Returns the properties of a temporary queue or a temporary topic with the given name.
Response Body:
The format for listing a single temporary queue is as follows:
<temporaryQueue> <name>queue name</name> <connection>name of the connection with which the queue is associated</connection> <canonicalLink>relative path to temporary queue</canonicalLink> </temporaryQueue>
The format for listing a single temporary topic is as follows:
<temporaryTopic> <name>topic name</name> <connection>name of the connection with which the topic is associated</connection> <canonicalLink>relative path to temporary topic</canonicalLink> </temporaryTopic>
The content of the <name>
element is the queueName
or topicName
.The <connection>
element is present only if the temporary queue or topic was created from a connection associated with the client's messaging context.
If the temporary queue or topic was created elsewhere and received as, for example, in the Reply-To
header of a message, then the <connection>
element will not be present.
Error Response:
Error Message | Description |
---|---|
|
The temporary destination that is requested does not exist. |
Remove a Temporary Destination
This section provides information about removing temporary destinations.
Method: DELETE
Path:
-
To delete a temporary queue, the path is
/temporaryQueues/
queueName
-
To delete a temporary topic, the path is
/temporaryTopics/
topicName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Deletes the temporary destination with the given name.
Note:
If the temporary destination that is being deleted was created from a connection in the same messaging context, the temporary destination will be deleted from the back-end. Else, it will be deleted only from the messaging context, and not from the back-end.
After being deleted from the back-end, the temporary destination will not be available for use to other clients.
Error Response:
Error Message | Description |
---|---|
|
The temporary destination whose deletion is requested does not exist. |
Creating and Managing Queue Browsers
This section provides information about creating and managing queue browsers in Oracle Messaging Cloud Service.
Topics:
Create a Queue Browser
A client uses a queue browser to look at messages on a queue without removing them. A queue browser is created from a Session.
A queue browser may be used to look at all the messages in a queue, or only those that match a message selector. Note that if messages are sent to a queue after a browser on that queue is created, those messages may not be visible via the queue browser.
Method: PUT
Path: /queueBrowsers
/browserName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Request Parameters:
Parameter | Description |
---|---|
|
The value is the name of the session in which the queue browser needs to be created. |
|
Specify the destination name. The value must have the form |
|
Message selector, which is optional. |
Result: Creates a queue browser on the destination
parameter.
Error Responses:
Error Message | Description |
---|---|
|
There is no session with the specified name. |
|
The destination that is requested does not exist. |
|
A queue browser with the specified name already exists. |
|
One of the following occurred:
|
Retrieve Queue Browser Properties
This section provides information about retrieving queue browser properties.
Method: GET
Path: /queueBrowsers/
browserName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: Returns properties of the queue browser with the name browserName
.
Response Body:
In XML, the format for the properties of a queue browser is as follows:
<queueBrowser> <name>client-assigned name of the browser</name> <queue>path specifying the persistent or temporary queue browsed</queue> <selector>selector expression<selector> <canonicalLink>relative path to queue browser</canonicalLink> </queueBrowser>
In JSON, the format for the properties of a queue browser is as follows:
{ "name": "client-assigned name of the browser", "queue": "path specifying the persistent or temporary queue browsed", "selector": "selector expression", "canonicalLink": "relative path to queue browser" }
The content of the queue
element has the form /queue/queueName
if the browser browses a persistent queue named queueName
; it has the form /temporaryQueue/queueName
if the browser browses a temporary queue named queueName
.
The selector
element is present only if the queue browser is associated with a selector.
Error Response:
Error Message | Description |
---|---|
|
The queue browser that is requested does not exist. |
Browse Messages
This topic provides information about browsing messages in a queue browser.
Method: POST
Path: /queueBrowsers/
browserName
Scope: Messaging Context
Authorization: Messaging Administrator or Messaging Worker
Result: If there is a message in the browser, it is returned in the HTTP response. Otherwise, a null response is returned.
Response Header:
If there is an X-OC-NULL
header with value true
, then it indicates that there are no more messages in the browser.
Error Response:
Error Message | Description |
---|---|
|
The queue browser that is requested does not exist. |
Remove a Queue Browser
This section provides information about removing a queue browser.
Method: DELETE
Scope: Messaging Context
Path: /queueBrowsers/browserName
Authorization: Messaging Administrator or Messaging Worker
Result: Closes and deletes the queue browser.
Error Response:
Error Message | Description |
---|---|
|
The queue browser that is requested does not exist. |