AQ how to register an agent from devart
Posted: Mon 14 Sep 2009 10:06
Hello
Is there an example how tho register an agent
in an oracle raw queue which would be for multipleConsumers?
I used the ODAC demo but there is a non multipleConsumer
sample.
code:
Oracle 9i testcode:
queuetable
BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table => 'trafdev.print_queue_table',
queue_payload_type => 'RAW',
multiple_consumers => TRUE);
END;
/
the so created user_data field of the queuetable is a blob
enqueuing
declare
r_enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
r_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
v_message_handle RAW(16);
o_payload RAW(200);
begin
o_payload := SYS.UTL_RAW.cast_to_raw ('Hello');
SYS.DBMS_AQ.ENQUEUE('print_queue', r_enqueue_options,
r_message_properties, o_payload, v_message_handle);
COMMIT;
end;
I couldn't find a working example how to create and set
TQueueAgents and TQueueAgent with multiple_consumers = YES,
so I used the OracleQueue properties which I set before.
procedure TForm1.Button1Click(Sender: TObject);
var
Agents: TQueueAgents;
Agent: TQueueAgent;
StringPayload : String;
MsgId: String;
begin
Agents := oq.EnqueueMessageProperties.RecipientList;
try
Agent := oq.EnqueueMessageProperties.RecipientList.Items[0];
try
oq.Listen(Agents, Agent, -1);
MsgId := oq.Dequeue(StringPayload);
memo1.Lines.Add('DEQUEUE: MsgId: ' + MsgId + ' Payload: ' +
StringPayload);
finally
Agent := nil;
end;
finally
Agents := nil;
end;
end;
Dequeuing works MsgId is OK, the queue is emptied but in
Payload I get '?????'
I have to admit that I am starting with Oracle Queuing.
Therefore any help would be much appreciated.
Best regards.
Kurt
Is there an example how tho register an agent
in an oracle raw queue which would be for multipleConsumers?
I used the ODAC demo but there is a non multipleConsumer
sample.
code:
Oracle 9i testcode:
queuetable
BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table => 'trafdev.print_queue_table',
queue_payload_type => 'RAW',
multiple_consumers => TRUE);
END;
/
the so created user_data field of the queuetable is a blob
enqueuing
declare
r_enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
r_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
v_message_handle RAW(16);
o_payload RAW(200);
begin
o_payload := SYS.UTL_RAW.cast_to_raw ('Hello');
SYS.DBMS_AQ.ENQUEUE('print_queue', r_enqueue_options,
r_message_properties, o_payload, v_message_handle);
COMMIT;
end;
I couldn't find a working example how to create and set
TQueueAgents and TQueueAgent with multiple_consumers = YES,
so I used the OracleQueue properties which I set before.
procedure TForm1.Button1Click(Sender: TObject);
var
Agents: TQueueAgents;
Agent: TQueueAgent;
StringPayload : String;
MsgId: String;
begin
Agents := oq.EnqueueMessageProperties.RecipientList;
try
Agent := oq.EnqueueMessageProperties.RecipientList.Items[0];
try
oq.Listen(Agents, Agent, -1);
MsgId := oq.Dequeue(StringPayload);
memo1.Lines.Add('DEQUEUE: MsgId: ' + MsgId + ' Payload: ' +
StringPayload);
finally
Agent := nil;
end;
finally
Agents := nil;
end;
end;
Dequeuing works MsgId is OK, the queue is emptied but in
Payload I get '?????'
I have to admit that I am starting with Oracle Queuing.
Therefore any help would be much appreciated.
Best regards.
Kurt