dotConnect for Oracle Documentation
Devart.Data.Oracle Namespace / OracleQueueMessage Class
Members Example

In This Topic
    OracleQueueMessage Class
    In This Topic
    Represents queue messages.
    Syntax
    'Declaration
     
    Public Class OracleQueueMessage 
    public class OracleQueueMessage 
    Remarks

    This class is available only in Professional and Developer Editions. It is not available in Standard and Mobile Editions.

    Example
    The following example demonstrates usage of OracleQueue, OracleQueueAdmin, OracleQueueTable, OracleQueueTableOptions, and OracleQueueMessage classes. For detailed description of advanced queuing and more samples, refer to the Advanced Queuing Technology article.
    static void Main(string[] args)
    {
            using (OracleConnection oracleConnection = new OracleConnection(
                            "User Id=system;Password=manager;Server=ora;Direct=False;")) {
                    oracleConnection.Open();
                    OracleCommand oracleCommand = new OracleCommand(
                            "CREATE OR REPLACE TYPE message AS OBJECT (nickname VARCHAR2(15), " +
                            "mestext VARCHAR2(80));", oracleConnection);
                    oracleCommand.ExecuteNonQuery();
                    OracleQueueTable oracleQueueTable = new OracleQueueTable("QUEUE_TABLE_MESSAGE", oracleConnection);
                    oracleQueueTable.Options.PayloadTypeName = "message";
                    oracleQueueTable.CreateQueueTable();
                    OracleQueueAdmin oracleQueueAdmin = new OracleQueueAdmin("MESSAGE_QUEUE",
                            "QUEUE_TABLE_MESSAGE", oracleConnection);
                    oracleQueueAdmin.CreateQueue();
                    oracleQueueAdmin.StartQueue();
                    OracleQueue oracleEnqueueQueue = new OracleQueue("MESSAGE_QUEUE", oracleConnection);
                    OracleObject mes = new OracleObject("message", oracleConnection);
                    mes["nickname"] = oracleConnection.UserId;
                    mes["mestext"] = "Hello, world!";
                    oracleEnqueueQueue.Enqueue(mes);
                    OracleQueue oracleDequeueQueue = new OracleQueue("MESSAGE_QUEUE", oracleConnection);
                    OracleQueueMessage msg = oracleDequeueQueue.Dequeue();
                    if (msg != null && msg.ObjectPayload != null) {
                            Console.WriteLine(msg.ObjectPayload["nickname"]);
                            Console.WriteLine(msg.ObjectPayload["mestext"]);
                    }
                    oracleQueueAdmin.StopQueue();
                    oracleQueueAdmin.DropQueue();
                    oracleQueueTable.DropQueueTable();
                    oracleConnection.Close();
            }
    }
    Sub Main()
            Using oracleConnection As New OracleConnection("User Id=system;Password=manager;Server=ora;Direct=False;")
                    oracleConnection.Open()
                    Dim oracleCommand As New OracleCommand("CREATE OR REPLACE TYPE message " & _
                            "AS OBJECT (nickname VARCHAR2(15), mestext VARCHAR2(80));", oracleConnection)
                    OracleCommand.ExecuteNonQuery()
                    Dim oracleQueueTable As New OracleQueueTable("QUEUE_TABLE_MESSAGE", oracleConnection)
                    oracleQueueTable.Options.PayloadTypeName = "message"
                    oracleQueueTable.CreateQueueTable()
                    Dim oracleQueueAdmin As New OracleQueueAdmin("MESSAGE_QUEUE", _
                            "QUEUE_TABLE_MESSAGE", oracleConnection)
                    oracleQueueAdmin.CreateQueue()
                    oracleQueueAdmin.StartQueue()
                    Dim oracleEnqueueQueue As New OracleQueue("MESSAGE_QUEUE", oracleConnection)
                    Dim mes As New OracleObject("message", oracleConnection)
                    mes.Item("nickname") = oracleConnection.UserId
                    mes.Item("mestext") = "Hello, world!"
                    oracleEnqueueQueue.Enqueue(mes)
                    Dim oracleDequeueQueue As New OracleQueue("MESSAGE_QUEUE", oracleConnection)
                    Dim msg As OracleQueueMessage = oracleDequeueQueue.Dequeue()
                    If ((Not msg Is Nothing) AndAlso (Not msg.ObjectPayload Is Nothing)) Then
                            Console.WriteLine(msg.ObjectPayload.Item("nickname"))
                            Console.WriteLine(msg.ObjectPayload.Item("mestext"))
                    End If
                    oracleQueueAdmin.StopQueue()
                    oracleQueueAdmin.DropQueue()
                    oracleQueueTable.DropQueueTable()
                    oracleConnection.Close()
        End Using
    End Sub
    Inheritance Hierarchy

    System.Object
       Devart.Data.Oracle.OracleQueueMessage

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also