Forum Stats

  • 3,816,531 Users
  • 2,259,202 Discussions


AQ Register Callback

3004 Member Posts: 204,171 Green Ribbon
Is there anyone who have used OO4O monitoring messages feature before? The OO4O online help is quite vague. Is there any other good sources which I can look into?


  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    We are using this feature. I don't know that we ever found any better documentation, and our developer had to struggle with it for a while.
  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Todd Cox ([email protected]):
    We are using this feature. I don't know that we ever found any better documentation, and our developer had to struggle with it for a while.<HR></BLOCKQUOTE>
    I found a article posted last year in OO4O section related to the call back feature. Unfortunatelly, it doesn't help much. I was disppointed Oracle can't provide more solid documentations and working sample codes to developers. We are using their tech, isn't it? Actually, I gave up using AQ async. notification and turn to Microsoft MSMQ. If you still need to do async. notification from Oracle, the solution I use is that I use Oracle UTL_HTTP package to insert a message into MSMQ. Then MSMQ fire an event and my ap catch it and do the jobs accordingly.
  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    There is an example of using Async notifications in Oracle 8i Appliation Developers guide - Advanced Queueing - in chpater 8 - "Asynchrnonous notifications" section

    There is also a OCI demo in $ORACLE_HOME/rdbms/demo/cdemosyev.c and cdemosyev.sql, cdemosyex.sql
  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    cdemosyev.c is working fine till notification means invoking the callback function but then after I am getting and error at OCITypeByName .
    When I dont use publish-subscribe mode the same code works fine.
    help me out !!!
  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    Please post oo4o questions on oo4o forum as the response time will be quicker.
    There are posts related to the oo4o monitor in the oo4o group as well. So, you may want to take a look at those.
    Also, there is a sample for monitor under oo4o\samples\aq in ORACLE_HOME.
    Monitor is used to dequeue messages asynchronously. The oo4o server notifies a callback handler when new messages are dequeued. The callback handler should be a VB activex module that implements the method NotifyMe. This is required as the oo4o server will call the NotifyMe method of the VB class when a new message is dequeued.
    The usage is as follows :
    1. Define a VB Class module which implements a method called NotifyMe. NotifyMe should expect two arguments : Context and Msgid.
    Ctx refers to any context-sensitive information that the main application might want the server to pass onto the NotifyMe method.This is the context that was passed in to MonitorStart.

    Public Sub NotifyMe(ByVal Ctx As Variant, ByVal Msgid As Variant)
    On Error GoTo NotifyMeErr
    Dim OraNewMsg As Object
    mvarMsgid = Msgid
    Set OraNewMsg = Ctx.AQMsg
    ' Display this message using the
    ' GetMessage method
    Monitor.GetMessage OraNewMsg, Msgid
    Set OraNewMsg = Nothing
    Exit Sub
    Call RaiseError(MyUnhandledError, "newcallback:NotifyMe Method")
    End Sub

    2. In the main form or application
    Instantiate the class module that was defined in 1.

    Public CB_Client As New newcallback

    3. In the code, call MonitorStart passing in the CB_Client as the callback handler. You can also pass in any context-sensitive information. In the eg. below, I am passing in OraAq object as the reference for tracking down the context when I receive messages.
    Public OraDatabase As Object
    Public OraAq As Object
    ... Create OraSession,OraDatabase and instantiate OraAq
    Dim OraMsg As Object
    Set OraMsg = OraAq.AQMsg
    OraAq.MonitorStart CB_Client, OraAq

    Now when any messages are dequeued by the oo4o server, the server will call the NotifyMe and pass on the Msgid of the new message and the context which is the OraAq that I passed in when calling MonitorStart

    4. To see the message :The newly dequeued message will be part of the AQ object.
    Since ctx contains the AQ instance, you can see the newly dequeued message just by:
    Set OraNewMsg = Ctx.AQMsg

    Please email me with your specific problems at [email protected] or if you need test samples or more details.
    Hope this helps,

This discussion has been closed.