how to get TOraQueue AsyncNotification = True to work?

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jeroenp
Posts: 5
Joined: Fri 29 Oct 2010 15:09

how to get TOraQueue AsyncNotification = True to work?

Post by jeroenp » Wed 10 Nov 2010 16:28

I have a very simple demo project; all components are in a data module.
I can retrieve data using a TOraQueue succesfully.

Next step is asynchronous notification.
I've tried setting AsyncVVI_VVI_IN_OraQueue.AsyncNotification := True; after opening the connection, but my OnMessage is never called (the breakpoint never fires, I don't hear beeping without a breakpoint).

Below are the components and the source code.
What am I doing wrong here?

Components:

Code: Select all

object VVI_OraSession: TOraSession
  Username = 'vvi'
  Password = '########'
  Server = 'AQUARIUS'
  LoginPrompt = False
  Left = 48
  Top = 20
end
object AsyncVVI_VVI_IN_OraQueue: TOraQueue
  Session = VVI_OraSession
  QueueName = 'VVI.VVI_IN'
  DequeueOptions.WaitTimeout = 5
  AsyncNotification = True
  OnMessage = AsyncVVI_VVI_IN_OraQueueMessage
  Left = 128
  Top = 96
end
Code:

Code: Select all

procedure TOracleAQDataModule.Enable_AsyncVVI_VVI_IN_OraQueue_AsyncNotification;
begin
   AsyncVVI_VVI_IN_OraQueue.Session.Open();
   AsyncVVI_VVI_IN_OraQueue.AsyncNotification := True;
end;

procedure TOracleAQDataModule.AsyncVVI_VVI_IN_OraQueueMessage(Sender: TOraQueue; const MessageId: string; const MessageProperties: TQueueMessageProperties);
begin
   if Windows.GetCurrentThreadId()  System.MainThreadID then // *** beakpoint here
      SysUtils.Beep()
   else
      SysUtils.Beep();
end;
--jeroen[/b]

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 11 Nov 2010 09:15

Hello,

The OnMessage event occurs only when a new message is enqueued.
For more information please look the Queue demo project and the Working with TOraQueue topic in the ODAC help.

jeroenp
Posts: 5
Joined: Fri 29 Oct 2010 15:09

Post by jeroenp » Fri 12 Nov 2010 09:15

I know OnMessage should only fire when a new message is queueud.

Another app is queueing messages, and I can succesfully dequeue them.
But I don't get notifications.
Why?

I need to ask the DBA if I can create the queues from the demo, even though it is a test Oracle server, and I have enough rights to perform creates and such, the test Oracle server is supposed to look as much as the production server.

This is how the queue and underlying table are defined; maybe you can spot an issue?

Code: Select all

  DBMS_AQADM.CREATE_QUEUE_TABLE(
    Queue_table        => 'QTAB_PROPAGATIE_DESTS',
    Queue_payload_type => 'SYS.AQ$_JMS_BYTES_MESSAGE',
    Sort_list          => 'ENQ_TIME',
    Compatible         => '8.1.3',
    comment            => 'VVI_IN',
    multiple_consumers => FALSE,
    auto_commit        => FALSE,
    message_grouping   => DBMS_AQADM.NONE
    );

Code: Select all

    DBMS_AQADM.CREATE_QUEUE(
      Queue_name          => 'VVI_IN',
      Queue_table         => 'QTAB_PROPAGATIE_DESTS',
      Queue_type          =>  0,
      Max_retries         =>  0,
      Retry_delay         =>  0,
      Retention_time      =>  604800,
      dependency_tracking =>  FALSE,
      comment             => 'VVI_IN'
      );
      
    DBMS_AQADM.START_QUEUE(
      Queue_name          => 'VVI_IN',
      Enqueue             => TRUE,
      Dequeue             => TRUE
      );
Thanks in advance,

--jeroen

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 15 Nov 2010 09:40

Hello,

We can get the OnMessage event on the Oracle 11 server using the Oracle 10 and 11 client, but on the Oracle 10 server the event doesn't work. Seems the problem is connected with the settings of the Oracle server. Please contact your system administrator, maybe he will help you.

Post Reply