Oracle Objects for OLE
Release 9.0.1

Part Number A90173-01

Home

Book List

Contents

Master Index

Feedback

Example: Enqueuing Messages

Enqueuing messages of type RAW

'Create an OraAQ object for the queue "DBQ"

Dim Q as OraAQ

Dim Msg as OraAQMsg

Dim OraSession as OraSession

Dim DB as OraDatabase

Set OraSession = CreateObject("OracleInProcServer.XOraSession")

Set DB = OraSession.OpenDatabase(mydb,
scott/tiger" 0&)

Set Q = DB.CreateAQ("DBQ")

'Get a reference to the AQMsg object

Set Msg = Q.AQMsg

Msg.Value = "Enqueue the first message to a RAW queue."

'Enqueue the message

Q.Enqueue()

'Enqueue another message.

Msg.Value = "Another message"

Q.Enqueue()

'Enqueue a message with non-default properties.

Msg.Priority = ORAQMSG_HIGH_PRIORITY

Msg.Delay = 5

Msg.Value = "Urgent message"

Q.Enqueue()

Msg.Value = "The visibility option used in the enqueue call is

ORAAQ_ENQ_IMMEDIATE"

Q.Visible = ORAAQ_ENQ_IMMEDIATE

Msgid = Q.Enqueue

'Enqueue Ahead of message Msgid_1

Msg.Value = "First Message to test Relative Message id"

Msg.Correlation = "RELATIVE_MESSAGE_ID"

Msgid_1 = Q.Enqueue

Msg.Value = "Second message to test RELATIVE_MESSAGE_ID is queued

ahead of the First Message "

OraAq.relmsgid = Msgid_1

Msgid = Q.Enqueue

Enqueuing messages of Oracle object types

'Prepare the message. MESSAGE_TYPE is a user defined type

' in the "AQ" schema

Set OraMsg = Q.AQMsg(1, "MESSAGE_TYPE","SCOTT")

Set OraObj = DB.CreateOraObject("MESSAGE_TYPE")

OraObj("subject").Value = "Greetings from OO4O"

OraObj("text").Value = "Text of a message originated from OO4O"

Set OraMsg.Value = OraObj

Msgid = Q.Enqueue


 
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.

Home

Book List

Contents