How to set an attribute called "header" ("SYS.AQ$_JMS_HEADER

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
MDrueck
Posts: 18
Joined: Fri 01 Apr 2011 14:06
Location: Germany

How to set an attribute called "header" ("SYS.AQ$_JMS_HEADER

Post by MDrueck » Fri 01 Apr 2011 14:27

Hi,

I'm new to the ODAC components and Oracle Queues in general.

I used the code from "..\Devart\Odac for RAD Studio 2010\Demos\OdacDemo\Queue\Queue.pas" and altered it.

Code: Select all

procedure TQueueFrame.btEnqueueClick(Sender: TObject);
var
  MsgProperties: TQueueMessageProperties;
  StringPayload, MsgId: string;
  ObjectPayload: TOraObject;
begin
  MsgProperties := TQueueMessageProperties.Create;
  try
    MsgProperties.Priority := StrToInt(edPriority.Text);

    if rbUseRaw.Checked then begin
...
    end
    else begin
      ObjectPayload := TOraObject.Create;
      try
        OdacForm.OraSession.Connect; // session must be connected before using its OCISvcCtx property
//        ObjectPayload.AllocObject(OdacForm.OraSession.OCISvcCtx, 'OBJ_ODAC_DEPT');
        ObjectPayload.AllocObject(OdacForm.OraSession.OCISvcCtx, 'SYS.AQ$_JMS_TEXT_MESSAGE');
        try
//          ObjectPayload.AttrAsInteger['DeptNo'] := StrToInt(edPayloadDeptNo.Text);
          ObjectPayload.AttrAsString['TEXT_VC'] := memPayload.Text; // memPayload is a Memo
        except
...
        end;
//        ObjectPayload.AttrAsString['DeptName'] := edPayloadDeptName.Text;

        MsgId := QueueObject.Enqueue(ObjectPayload, MsgProperties);

        meLog.Lines.Add('ENQUEUE: MsgId: "' + MsgId + '" Payload: "' +
          ObjectPayload.AttrAsString['TEXT_VC'] + '"');
      finally
        ObjectPayload.Free;
      end;
    end;
  finally
    MsgProperties.Free;
  end;
end;
Everything works fine so far, my result in the "meLog" memo is:

Code: Select all

ENQUEUE: MsgId: "9FDD0DBDC5A9EF4DE0402B0A2F036BC7" Payload: "

"
But our customer says that an attribute "header" ("SYS.AQ$_JMS_HEADER") with a value for "text_len" (with a value of "612") should be created. How and where do I create such a header?

They gave me this example:

Code: Select all

SYS.AQ$_JMS_TEXT_MESSAGE(SYS.AQ$_JMS_HEADER(NULL,NULL,NULL,NULL,NULL,NULL,NULL),612,
'
',NULL)
Any ideas are welcome.

TIA, M. Drück

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

Post by AlexP » Tue 05 Apr 2011 13:45

hello,

Now you can't get such result with the TOraQueue component.
But you can use the following workaround - call the DBMS_AQ.ENQUEUE method in PL/SQL, or create your own procedure like:

Code: Select all

create or replace procedure My_Queue AS
  msg SYS.AQ$_JMS_TEXT_MESSAGE;
  msg_hdr SYS.AQ$_JMS_HEADER;
  queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
  msg_props DBMS_AQ.MESSAGE_PROPERTIES_T;
  msg_id RAW(16);
  dummy VARCHAR2(4000);
begin
  msg_hdr := SYS.AQ$_JMS_HEADER(nullt,null,null,null,null,null,null);
  msg := SYS.AQ$_JMS_TEXT_MESSAGE(msg_hdr,null,null,null);
  msg.text_vc := 'value';
  msg.text_len := length(msg.text_vc);
  DBMS_AQ.ENQUEUE( queue_name => 'MyQueue'
                 , enqueue_options => queue_options
                 , message_properties => msg_props
                 , payload => msg
                 , msgid => msg_id);
end;
We will investigate the possibility of making the Enqueue method virtual, so that you could override it.

MDrueck
Posts: 18
Joined: Fri 01 Apr 2011 14:06
Location: Germany

Post by MDrueck » Mon 11 Jul 2011 12:17

Hello,
AlexP wrote: Now you can't get such result with the TOraQueue component. But you can use the following workaround - call the DBMS_AQ.ENQUEUE method in PL/SQL ...
To be honest, I have no idea how to do that. And anyhow, how should that work, using a Delphi application and ODAC components and calling the DBMS_AQ.ENQUEUE method in PL/SQL? Do you have any short example for that?
AlexP wrote: ... or create your own procedure like:

Code: Select all

create or replace procedure My_Queue AS
  msg SYS.AQ$_JMS_TEXT_MESSAGE;
  msg_hdr SYS.AQ$_JMS_HEADER;
  queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
  msg_props DBMS_AQ.MESSAGE_PROPERTIES_T;
  msg_id RAW(16);
  dummy VARCHAR2(4000);
begin
  msg_hdr := SYS.AQ$_JMS_HEADER(nullt,null,null,null,null,null,null);
  msg := SYS.AQ$_JMS_TEXT_MESSAGE(msg_hdr,null,null,null);
  msg.text_vc := 'value';
  msg.text_len := length(msg.text_vc);
  DBMS_AQ.ENQUEUE( queue_name => 'MyQueue'
                 , enqueue_options => queue_options
                 , message_properties => msg_props
                 , payload => msg
                 , msgid => msg_id);
end;
We do not have the possibilty to create anything on that server. So creating our own queue is not an option.
AlexP wrote: We will investigate the possibility of making the Enqueue method virtual, so that you could override it.
Did you realize that in the meantime?

TIA, Markus

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

Post by AlexP » Mon 11 Jul 2011 14:02

Hello,

You can use the following code to obtain the needed result:

Code: Select all

BEGIN
  DBMS_AQADM.CREATE_QUEUE_TABLE( Queue_table => 'SCOTT.MY_QT_SAMPLE', Queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE', storage_clause => 'PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 TABLESPACE USERS', Sort_list => 'ENQ_TIME', Compatible => '8.1.3');
END;

BEGIN
  DBMS_AQADM.CREATE_QUEUE( Queue_name => 'SCOTT.MY_QU_SAMPLE', Queue_table => 'SCOTT.MY_QT_SAMPLE', Queue_type => 0, Max_retries => 5, Retry_delay => 0, dependency_tracking => FALSE, COMMENT => 'Test queue');
END;

Code: Select all

procedure TForm5.btnEnqueueClick(Sender: TObject);
var
  OraSQl: TOraSQL;
begin
  OraSQl:= TOraSQL.Create(nil);
  OraSQL.Session := OraSession1;
  OraSQL.SQL.Text := 'declare' + #13 +
                     'msg SYS.AQ$_JMS_TEXT_MESSAGE;' + #13 +
                     'msg_hdr SYS.AQ$_JMS_HEADER;' + #13 +
                     'queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;' + #13 +
                     'msg_props DBMS_AQ.MESSAGE_PROPERTIES_T;' + #13 +
                     'begin' + #13 +
                     'msg_hdr := SYS.AQ$_JMS_HEADER(null,null,null,null,null,null,null);' + #13 +
                     'msg := SYS.AQ$_JMS_TEXT_MESSAGE(msg_hdr,null,null,null);' + #13 +
                     'msg.text_vc := :text;' + #13 +
                     'msg.text_len := length(msg.text_vc);' + #13 +
                     'DBMS_AQ.ENQUEUE( queue_name => ''MY_QU_SAMPLE''' + #13 +
                     '               , enqueue_options => queue_options' + #13 +
                     '               , message_properties => msg_props' + #13 +
                     '               , payload => msg' + #13 +
                     '               , msgid => :msg_id);' + #13 +
                     ':txt := msg.text_vc;' + #13 +
                     ':ln := msg.text_len;' + #13 +
                     'end;';
  OraSQL.Prepare;
  OraSQL.ParamByName('text').DataType := ftString;
  OraSQL.ParamByName('text').ParamType:= ptInput;
  OraSQL.ParamByName('msg_id').DataType := ftString;
  OraSQL.ParamByName('msg_id').ParamType := ptOutput;
  OraSQL.ParamByName('txt').DataType := ftString;
  OraSQL.ParamByName('txt').ParamType := ptOutput;
  OraSQL.ParamByName('ln').DataType := ftInteger;
  OraSQL.ParamByName('ln').ParamType := ptOutput;
  OraSQL.ParamByName('text').AsString := '';
  OraSQL.Execute;
  Memo1.Lines.Add(Format('ENQUEUE: MsgId: %s Payload: %s length: %d', [OraSQL.ParamByName('msg_id').AsString,OraSQL.ParamByName('txt').AsString, OraSQL.ParamByName('ln').AsInteger]));
end;

procedure TForm5.btnDequeueClick(Sender: TObject);
var
  OraQueue: TOraQueue;
  ObjectPayload: TOraObject;
  MsgId: String;
begin
  OraQueue:= TOraQueue.Create(nil);
  OraQueue.Session := OraSession1;
  OraQueue.QueueName := 'SCOTT.MY_QU_SAMPLE';
  ObjectPayload := TOraObject.Create;
  MsgId:= OraQueue.Dequeue(ObjectPayload);
  Memo1.Lines.Add(Format('DEQUEUE: MsgId: %s  Payload: %s length: %d',[MsgId,ObjectPayload.AttrAsString['text_vc'],ObjectPayload.AttrAsInteger['text_len']]));
end;

MDrueck
Posts: 18
Joined: Fri 01 Apr 2011 14:06
Location: Germany

Post by MDrueck » Fri 22 Jul 2011 08:10

Hello Alex,
AlexP wrote:You can use the following code to obtain the needed result:
Thanks a lot. With your code I'm receiving "something" during the dequeuing. "Something" means the "length" value is for example "14655", but the Payload is "" (empty). Any idea what's wrong here?

I really appreciate your feedback. Thanks in advance. M. Drück

my component "mom_out" as text:

Code: Select all

object mom_out: TMemo
  Left = 0
  Top = 40
  Width = 784
  Height = 344
  Align = alBottom
  Font.Charset = ANSI_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Courier New'
  Font.Style = []
  Lines.Strings = (
    
      ''
    ''
    ''
    
      'q4de3msys11:7384cfc6:125feac3cf8:-7fe8'
    '1.3'
    'DATASET'
    ''
    'op_turn'
    '2011-07-20T00:00:00.000'
    '2011-07-27T23:59:59.000'
    ''
    '##timestamp##'
    ''
    ''
    ''
    '')
  ParentFont = False
  TabOrder = 1
end
my component "OraSession1" as text:

Code: Select all

object OraSession1: TOraSession
  Username = 'am'
  Password = '*******'
  Server = '******'
  LoginPrompt = False
  AfterConnect = OraSession1AfterConnect
  BeforeConnect = OraSession1BeforeConnect
  AfterDisconnect = OraSession1AfterDisconnect
  BeforeDisconnect = OraSession1BeforeDisconnect
  OnLogin = OraSession1Login
  OnError = OraSession1Error
  OnConnectionLost = OraSession1ConnectionLost
  OnConnectChange = OraSession1ConnectChange
  OnFailover = OraSession1Failover
  OnInfoMessage = OraSession1InfoMessage
  Left = 472
  Top = 24
end
I altered your code for btnEnqueueNativeClick:

Code: Select all

procedure TForm1.btnEnqueueNativeClick(Sender: TObject);
var
  OraSQl: TOraSQL;
  s: AnsiString;
  OldDateTimeFormat: string;
begin
  OldDateTimeFormat := '' +
    FormatDateTime('YYYY-MM-DD', Now) + 'T' +
    FormatDateTime('hh:nn:ss.zzz', Now) +
    '';
  s := StringReplace(mom_out.Lines.Text, '##timestamp##', OldDateTimeFormat, [rfReplaceAll]);

  OraSQl:= TOraSQL.Create(nil);
  OraSQL.Session := OraSession1;
  OraSQL.SQL.Text := 'declare' + #13 +
                     'msg SYS.AQ$_JMS_TEXT_MESSAGE;' + #13 +
                     'msg_hdr SYS.AQ$_JMS_HEADER;' + #13 +
                     'queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;' + #13 +
                     'msg_props DBMS_AQ.MESSAGE_PROPERTIES_T;' + #13 +
                     'begin' + #13 +
                     'msg_hdr := SYS.AQ$_JMS_HEADER(null,null,null,null,null,null,null);' + #13 +
                     'msg := SYS.AQ$_JMS_TEXT_MESSAGE(msg_hdr,null,null,null);' + #13 +
                     'msg.text_vc := :text;' + #13 +
                     'msg.text_len := length(msg.text_vc);' + #13 +
                     'DBMS_AQ.ENQUEUE( queue_name => ''FARMSMQ.AQ_FROM_AM''' + #13 +
                     '               , enqueue_options => queue_options' + #13 +
                     '               , message_properties => msg_props' + #13 +
                     '               , payload => msg' + #13 +
                     '               , msgid => :msg_id);' + #13 +
                     ':txt := msg.text_vc;' + #13 +
                     ':ln := msg.text_len;' + #13 +
                     'end;';
  OraSQL.Prepare;
  OraSQL.ParamByName('text').DataType := ftString;
  OraSQL.ParamByName('text').ParamType:= ptInput;
  OraSQL.ParamByName('msg_id').DataType := ftString;
  OraSQL.ParamByName('msg_id').ParamType := ptOutput;
  OraSQL.ParamByName('txt').DataType := ftString;
  OraSQL.ParamByName('txt').ParamType := ptOutput;
  OraSQL.ParamByName('ln').DataType := ftInteger;
  OraSQL.ParamByName('ln').ParamType := ptOutput;
  OraSQL.ParamByName('text').AsString := s;
  LogData(Format('SQL.Text:' + #13#10 + '[%s]', [OraSQL.SQL.Text]));
  LogData('Start: OraSQL.Execute');
  OraSQL.Execute;
  LogData(Format('ENQUEUE:' + #13#10 + 'MsgId: [%s]' + #13#10 + 'Payload: [%s]' + #13#10 + 'Length: [%d]',
      [OraSQL.ParamByName('msg_id').AsString, OraSQL.ParamByName('txt').AsString, OraSQL.ParamByName('ln').AsInteger]));
  LogData('Stop: OraSQL.Execute');
end;
I altered your code for btnDequeueNativeClick:

Code: Select all

procedure TForm1.btnDequeueNativeClick(Sender: TObject);
var
  OraQueue: TOraQueue;
  ObjectPayload: TOraObject;
  MsgId: string;
  s: AnsiString;
begin
  OraQueue := TOraQueue.Create(nil);
  OraQueue.Session := OraSession1;
  OraQueue.QueueName := 'FARMSMQ.AQ_TO_AM';
  ObjectPayload := TOraObject.Create;
  LogData('Start: OraQueue.Dequeue(ObjectPayload)');
  MsgId := OraQueue.Dequeue(ObjectPayload);
  LogData(Format('DEQUEUE:' + #13#10 + 'MsgId: [%s]' + #13#10 + 'Payload: [%s]' + #13#10 + 'Length: [%d]',
      [MsgId, ObjectPayload.AttrAsString['text_vc'], ObjectPayload.AttrAsInteger['text_len']]));
  LogData('Stop: OraQueue.Dequeue(ObjectPayload)');
end;

procedure TForm1.LogData(s: string);
begin
 Memo1.Lines.Add(DateTimeToStr(now)+': '+s);
end;
the result in the Memo1 after executing "btnEnqueueNative" and "btnDequeueNative":

Code: Select all

21.07.2011 10:03:41: OraSession1BeforeConnect
21.07.2011 10:03:42: OraSession1ConnectChange
21.07.2011 10:03:42: OraSession1AfterConnect
21.07.2011 10:03:44: SQL.Text:
[declare
msg SYS.AQ$_JMS_TEXT_MESSAGE;
msg_hdr SYS.AQ$_JMS_HEADER;
queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
msg_props DBMS_AQ.MESSAGE_PROPERTIES_T;
begin
msg_hdr := SYS.AQ$_JMS_HEADER(null,null,null,null,null,null,null);
msg := SYS.AQ$_JMS_TEXT_MESSAGE(msg_hdr,null,null,null);
msg.text_vc := :text;
msg.text_len := length(msg.text_vc);
DBMS_AQ.ENQUEUE( queue_name => 'FARMSMQ.AQ_FROM_AM'
               , enqueue_options => queue_options
               , message_properties => msg_props
               , payload => msg
               , msgid => :msg_id);
:txt := msg.text_vc;
:ln := msg.text_len;
end;
]
21.07.2011 10:03:44: Start: OraSQL.Execute
21.07.2011 10:03:44: ENQUEUE:
MsgId: [A890CB3F6C170B17E0402B0A2F03059D]
Payload: [


q4de3msys11:7384cfc6:125feac3cf8:-7fe8
1.3
DATASET

op_turn
2011-07-20T00:00:00.000
2011-07-27T23:59:59.000

2011-07-21T10:03:44.687




]
Length: [651] 
21.07.2011 11:13:22: Stop: OraSQL.Execute
21.07.2011 11:13:22: Start: OraQueue.Dequeue(ObjectPayload)
21.07.2011 11:13:24: DEQUEUE:
MsgId: [A86BCC80E5E9AD9DE0402B0A2F034FB6]
Payload: []
Length: [14655]
21.07.2011 11:13:24: Stop: OraQueue.Dequeue(ObjectPayload)

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

Post by AlexP » Fri 22 Jul 2011 09:32

Hello,

As it can be seen from your code, you are using different queue names when using the Enqueue and Dequeue methods: FARMSMQ.AQ_FROM_AM when using Enqueue, and FARMSMQ.AQ_TO_AM when using Dequeue. That's why you get a wrong result. If you fix the Dequeue call by setting the queue name to FARMSMQ.AQ_FROM_AM, you will get a correct result.

Code: Select all

22.07.2011 12:18:46: SQL.Text:
[declare
msg SYS.AQ$_JMS_TEXT_MESSAGE;
msg_hdr SYS.AQ$_JMS_HEADER;
queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
msg_props DBMS_AQ.MESSAGE_PROPERTIES_T;
begin
msg_hdr := SYS.AQ$_JMS_HEADER(null,null,null,null,null,null,null);
msg := SYS.AQ$_JMS_TEXT_MESSAGE(msg_hdr,null,null,null);
msg.text_vc := :text;
msg.text_len := length(msg.text_vc);
DBMS_AQ.ENQUEUE( queue_name => 'SCOTT.AQ_FROM_AM'
               , enqueue_options => queue_options
               , message_properties => msg_props
               , payload => msg
               , msgid => :msg_id);
:txt := msg.text_vc;
:ln := msg.text_len;
end;
]
22.07.2011 12:18:46: Start: OraSQL.Execute
22.07.2011 12:18:46: ENQUEUE:
MsgId: [5994730E029D4CD4A4009CF9C4A6E745]
Payload: [


q4de3msys11:7384cfc6:125feac3cf8:-7fe8
1.3
DATASET

op_turn
2011-07-20T00:00:00.000
2011-07-27T23:59:59.000

2011-07-22T12:18:46.518'




]
Length: [650]
22.07.2011 12:18:46: Stop: OraSQL.Execute

22.07.2011 12:18:54: Start: OraQueue.Dequeue(ObjectPayload)
22.07.2011 12:18:54: DEQUEUE:
MsgId: [5994730E029D4CD4A4009CF9C4A6E745]
Payload: [


q4de3msys11:7384cfc6:125feac3cf8:-7fe8
1.3
DATASET

op_turn
2011-07-20T00:00:00.000
2011-07-27T23:59:59.000

2011-07-22T12:18:46.518'




]
Length: [650]
22.07.2011 12:18:54: Stop: OraQueue.Dequeue(ObjectPayload)

MDrueck
Posts: 18
Joined: Fri 01 Apr 2011 14:06
Location: Germany

Post by MDrueck » Fri 22 Jul 2011 11:20

Hello,
AlexP wrote:As it can be seen from your code, you are using different queue names when using the Enqueue and Dequeue methods: FARMSMQ.AQ_FROM_AM when using Enqueue, and FARMSMQ.AQ_TO_AM when using Dequeue. That's why you get a wrong result. If you fix the Dequeue call by setting the queue name to FARMSMQ.AQ_FROM_AM, you will get a correct result.
We are using different queues, thats correct. We are told to do so. I'm not familiar with Oracle Queues, but reading your advice it seems that this is not very common. We are not the owner or creator of the queues, we only use them as a third party.

Any idea how it is possible to get a value higher than 0 in

Code: Select all

ObjectPayload.AttrAsInteger['text_len']
but the

Code: Select all

ObjectPayload.AttrAsString['text_vc']
is empty? This seems very strange to me.

TIA, M. Drück

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

Post by AlexP » Fri 22 Jul 2011 12:25

Hello,

Please provide us scripts to create both queues and a sample in which the FARMSMQ.AQ_TO_AM is filled.

MDrueck
Posts: 18
Joined: Fri 01 Apr 2011 14:06
Location: Germany

Post by MDrueck » Fri 22 Jul 2011 12:37

Hello,
AlexP wrote:Please provide us scripts to create both queues and a sample in which the FARMSMQ.AQ_TO_AM is filled.
I only have the code (from the documentation provided by the owner of the oracle database) for the queues. I'm not able to provide sample data, because we don't run the oracle database.

TIA, M. Drück

Code: Select all

BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE
(
QUEUE_TABLE => 'AQIF_FROM_AM_TABLE'
,QUEUE_PAYLOAD_TYPE => 'SYS.AQ$_JMS_TEXT_MESSAGE'
,COMPATIBLE => '8.1.3'
,STORAGE_CLAUSE => 'TABLESPACE TS_AODB_QUEUES
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL KEEP
)'
,SORT_LIST => 'ENQ_TIME'
,MULTIPLE_CONSUMERS => FALSE
,MESSAGE_GROUPING => 0
);
END;
/
BEGIN
SYS.DBMS_AQADM.CREATE_QUEUE
(
QUEUE_NAME => 'AQIF_FROM_AM'
,QUEUE_TABLE => 'AQIF_FROM_AM_TABLE'
,QUEUE_TYPE => SYS.DBMS_AQADM.NORMAL_QUEUE
,MAX_RETRIES => 25
,RETRY_DELAY => 0
,RETENTION_TIME => 0
);
END;
/
BEGIN
SYS.DBMS_AQADM.START_QUEUE
(
QUEUE_NAME => 'AQIF_FROM_AM'
,ENQUEUE => TRUE
,DEQUEUE => TRUE
);
END;
/
BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE
(
QUEUE_TABLE => 'AQIF_TO_AM_TABLE'
,QUEUE_PAYLOAD_TYPE => 'SYS.AQ$_JMS_TEXT_MESSAGE '
,COMPATIBLE => '8.1.3'
,STORAGE_CLAUSE => 'TABLESPACE TS_AODB_QUEUES
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL KEEP
)'
,SORT_LIST => 'ENQ_TIME'
,MULTIPLE_CONSUMERS => FALSE
,MESSAGE_GROUPING => 0
);
END;
/
BEGIN
SYS.DBMS_AQADM.CREATE_QUEUE
(
QUEUE_NAME => 'AQIF_TO_AM'
,QUEUE_TABLE => 'AQIF_TO_AM_TABLE'
,QUEUE_TYPE => SYS.DBMS_AQADM.NORMAL_QUEUE
,MAX_RETRIES => 25
,RETRY_DELAY => 0
,RETENTION_TIME => 0
);
END;
/
BEGIN
SYS.DBMS_AQADM.START_QUEUE
(
QUEUE_NAME => 'AQIF_TO_AM'
,ENQUEUE => TRUE
,DEQUEUE => TRUE
);
END;
/

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

Post by AlexP » Fri 22 Jul 2011 13:55

Hello,

As you can see from the code I've sent you before, the msg.text_len variable is filled manually, so you can assign any value to it. For example, you can assign an empty string to text_vc and any value to text_len:
...
'msg.text_vc :=''''' + #13 +
'msg.text_len := 12345;' + #13 +
......
In this case after calling Dequeue you'll get the result you specified before:

Code: Select all

Payload: []
Length: [12345]
That's why I cannot give a more detailed answer without the code sample where the AQ_TO_AM queue is filled.

Post Reply