ヘッダーをスキップ
Oracle® Objects for OLE開発者ガイド
11gリリース2 (11.2) for Microsoft Windows
B58887-04
  目次へ移動
目次
索引へ移動
索引

前
 
次
 

Enqueue(OraAQ)メソッド

説明

このオブジェクトに含まれるメッセージ(OraAQMsg)をエンキューします。

使用方法

Msgid = Q.Enqueue

備考

正常に実行された場合、このメソッドはメッセージ識別子をバイト配列で戻します。それ以外の場合は、空の配列(NULL)を戻します。


注意:

次のサンプル・コードは、メッセージ・デキューの標準的な例ですが、そのままでは実行できません。

完全なAQサンプルは、\OO4O\VB\SAMPLES\AQディレクトリにあります。


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" 
 
Msg.delay = ORAAQ_MSG_NO_DELAY 
Msgid_1 = Q.Enqueue 
Msg.Value = "Second message to test RELATIVE_MESSAGE_ID is queued" & _
            " ahead of the First Message " 
Q.RelMsgId = Msgid_1 
Msgid = Q.Enqueue

Oracleオブジェクト型のメッセージのエンキュー

'Prepare the message. MESSAGE_TYPE is a user defined type in the "AQ" schema 
Set OraMsg = Q.AQMsg(23, "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" 
 
Msgid = Q.Enqueue