An OracleAQMessage
object represents a message to be enqueued and dequeued.
System.Object
OracleAQMessage
// C# public sealed class OracleAQMessage
Provider | ODP.NET, Unmanaged Driver |
Assembly | Oracle.DataAccess.dll |
Namespace | Oracle.DataAccess.Client |
.NET Framework | 3.5, 4.0, 4.5 |
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
An OracleAQMessage
object consists of control information (metadata) and Payload (data). The control information is exposed by various properties on the OracleAQMessage
object and is used by Oracle Streams Advanced Queuing to manage messages. The payload is the information stored in the queue.
Note:
An instance ofOracleAQMessage
cannot be re-used across multiple operations of OracleAQQueue
public method Enqueue() or EnqueueArray(), if the payload is an XmlReader
. This is a direct consequence of the forward-only semantics of the XmlReader
, as an Enqueue() or EnqueueArray() operation internally invokes a read operation on the XmlReader
to extract the data to be enqueued.See Also:
OracleAQMessage
members are listed in the following tables.
OracleAQMessage
constructors are listed in Table 12-14.
Table 12-14 OracleAQMessage Constructors
Constructor | Description |
---|---|
Instantiates a new instance of the |
OracleAQMessage
properties are listed in Table 12-15.
Table 12-15 OracleAQMessage Properties
Property | Description |
---|---|
Specifies an identification for the message. |
|
Specifies the duration, in seconds, after which an enqueued message is available for dequeuing. |
|
Specifies the delivery mode of the dequeued message. |
|
Returns the number of attempts that have been made to dequeue the message. |
|
Specifies the time when the message was enqueued. |
|
Specifies the name of the queue that the message should be moved to if it cannot be processed successfully. |
|
Specifies the duration, in seconds, for which an enqueued message is available for dequeuing. |
|
Returns the message identifier. |
|
Specifies the identifier of the message in the last queue that generated this message. |
|
Specifies the payload of the message. |
|
Specifies the priority of the message. |
|
Specifies the list of recipients that overrides the default queue subscribers. |
|
Identifies the original sender of the message. |
|
Specifies the state of the message at the time of dequeue. |
|
Specifies the transaction group for the dequeued message. |
OracleAQMessage
constructors create new instances of the OracleAQMessage
class.
This constructor instantiates the OracleAQMessage
class.
This constructor instantiates the OracleAQMessage
class using the object provided as the payload.
See Also:
This constructor instantiates the OracleAQMessage
class.
// C# public OracleAQMessage();
This constructor instantiates the OracleAQMessage
class using the Object
provided as the payload
.
// C#
public OracleAQMessage(Object payload);
payload
An Object
specifying payload
. It can be one of the following types:
byte[]
IOracleCustomType
OracleBinary
OracleXmlType
String
XmlReader
ArgumentException
- The specified payload
value is of invalid type.
The ODP.NET AQ implementation currently does not support user defined types with LOB attributes. It also does not support other variants of user defined types such as VARRAY
and nested tables, as Oracle Streams AQ does not support them inherently.
OracleAQMessage
properties are listed in Table 12-16.
Table 12-16 OracleAQMessage Properties
Property | Description |
---|---|
Specifies an identification for the message. |
|
Specifies the duration, in seconds, after which an enqueued message is available for dequeuing. |
|
Specifies the delivery mode of the dequeued message. |
|
Returns the number of attempts that have been made to dequeue the message. |
|
Specifies the time when the message was enqueued. |
|
Specifies the name of the queue that the message should be moved to if it cannot be processed successfully. |
|
Specifies the duration, in seconds, for which an enqueued message is available for dequeuing. |
|
Returns the message identifier. |
|
Specifies the identifier of the message in the last queue that generated this message. |
|
Specifies the payload of the message. |
|
Specifies the priority of the message. |
|
Specifies the list of recipients that overrides the default queue subscribers. |
|
Identifies the original sender of the message. |
|
Specifies the state of the message at the time of dequeue. |
|
Specifies the transaction group for the dequeued message. |
See Also:
This instance property specifies an identification for the message.
// C# public string Correlation {get;set;}
A string
that specifies the identification for the message.
The producer of a message can set this property at the time of enqueuing. The consumer can then use this identification to dequeue specific messages by setting the Correlation
property of an OracleAQDequeueOptions
object. For more information regarding dequeuing messages based on Correlation
, refer to "Correlation" under the OracleAQDequeueOptions
class.
This instance property specifies the duration, in seconds, after which an enqueued message is available for dequeuing.
// C# public int Delay {get;set;}
An integer
that indicates the number of seconds after which an enqueued message is available for dequeuing.
ArgumentException
- The value specified is less than 0.
This property delays the immediate consumption of an enqueued message. The following are valid values for this property:
Positive integer - Indicates the delay in seconds.
0 - indicates that the message is immediately available for dequeuing.
The default value is 0. The Delay
property is not supported with buffered messaging.
This instance property specifies the delivery mode of the dequeued message.
// C# public OracleAQMessageDeliveryMode DeliveryMode {get;}
An OracleAQMessageDeliveryMode
enumerated value (OracleAQMessageDeliveryMode.Persistent
or OracleAQMessageDeliveryMode.Buffered
).
This instance property returns the number of attempts that have been made to dequeue the message.
// C# public int DequeueAttempts {get;}
An integer
that indicates the number of dequeue attempts.
This property is available in an OracleAQMessage
after the message has been dequeued from a queue.
This instance property specifies the time when the message was enqueued.
// C# public DateTime EnqueueTime {get;}
A DateTime
object.
This property is available after the message is dequeued. It provides the enqueue time of a dequeued message.
This instance property specifies the name of the queue that the message should be moved to if it cannot be processed successfully.
// C# public string ExceptionQueue {get;set;}
The name of the queue that a message should be moved to if it cannot be processed successfully. The default value is null
.
This property specifies the queue that a message should be moved to if the message has expired or if the number of unsuccessful dequeue attempts have exceeded the max_retries
value for the queue.
If this property is not set or the specified exception queue name does not exist, then the default exception queue associated with the queue table is used.
This instance property specifies the duration, in seconds, for which an enqueued message is available for dequeuing.
// C# public int Expiration {get;set;}
An integer
that specifies the number of seconds an enqueued message is available for dequeuing.
ArgumentException
- The value specified is less than -1.
The value specified is an offset from the value specified in the Delay
property.
The following are valid values for the property:
Positive integer - Indicates the expiration in seconds.
-1
- Indicates that the message never expires.
The default value is -1
. When a message expires, the message moves from the READY
state to the EXPIRED
state.
This instance property returns the message identifier.
// C# public byte[] MessageId {get;}
A byte[]
that specifies the message identifier.
This property is available after an enqueue or dequeue operation. Dequeued buffered messages have a null
value for MessageId
.
This instance property specifies the identifier of the message in the last queue that generated this message.
// C# public byte[] OriginalMessageId {get;}
A byte[]
that specifies the original message identifier.
This instance property specifies the payload of the message.
// C# public Object Payload {get;set;}
An Object
that specifies the payload of the message.
ArgumentException
- The specified object is not one of the allowed types.
For a complete discussion of various payload types, refer to "MessageType" under the OracleAQQueue
class.
This instance property specifies the priority of the message.
// C# public int Priority {get;set;}
An integer
that specifies the priority of the message.
The default value is 0. In order to take effect, this property must be set prior to enqueuing the message.
Smaller values indicate higher priority for the message. Negative values may also be used.
The priority of an enqueued message is useful for priority-based dequeuing.
This instance property specifies the list of recipients that overrides the default queue subscribers.
// C# public OracleAQAgent[] Recipients {get; set}
An OracleAQAgent[]
.
This recipient list is valid only for messages being enqueued to multiconsumer queues. The list of recipients is not returned with the message at the time of dequeuing.
This instance property identifies the original sender of the message.
// C# public OracleAQAgent SenderId {get; set}
An OracleAQAgent
object.
Sender identification is supported in all queue tables created with a database compatibility level of 8.1 or higher.
This instance property specifies the state of the message at the time of dequeue.
// C# public OracleAQMessageState State {get;}
An OracleAQMessageState
enumerated value.
This property is available after the message is dequeued.
The state of buffered messages dequeued by specifying Correlation
under dequeue options is always OracleAQMessageState.Ready
.
This instance property specifies the transaction group for the dequeued message.
// C# public string TransactionGroup {get;}
A string
that specifies the transaction group.
This property is set only after the call to DequeueArray
. This property is supported only when using Oracle Database 10g database or higher.
Messages belonging to one queue can be grouped to form a set that can only be consumed by one user at a time. This requires that the queue be created in a queue table that is enabled for message grouping. All messages belonging to a group must be created in the same transaction. Also, all messages created in one transaction belong to the same group.