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

In This Topic
    OracleQueueTable Class
    In This Topic
    Represent queue table for messages of a predefined type.
    Syntax
    Remarks

    This class is used to manage, create and drop the database table where message queues are stored. To use or configure queues themselves, either OracleQueue or OracleQueueAdmin class should be used.

    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
       System.MarshalByRefObject
          System.ComponentModel.Component
             Devart.Data.Oracle.OracleQueueTable

    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