Problems with TOracleQueue

Ol

Member
Hi

I try to use the TOracleQueue component. I have made the following actions:
1. Create new project
2. Drop on the form TOracleSession, TOracleQueue and TButton components.
3. Set TOracleQueue.Session property
4. Set TOracleQueue.QueueName property
5. Set to True TOracleQueue.ThreadSynchronized
6. Set DequeueOptions.Wait = 5
5. type the following code in TForm1.Button1Click:

Code:
OracleQueue1.StartThread;
6. type the following code in TForm1.OracleQueue1ThreadError:

Code:
Memo1.Lines.Add(ErrorMessage);
OracleQueue1.StopThread;
7. Run project and connect to DB
8. Press on button and start thread.
In Memo1 I get the following message:
OCI-21700: object does not exist...
OK, my user don't have any permissions for dequeue, it's normal, but my application buzzed after this! I can not close it! Only "Program Reset" menu item returns me into IDE.
I have a number similar problems with stopping in thread mode.
For example: I wrote the following code in OracleQueue1ThreadStop handler:
Code:
Memo1.Lines.Add('Thread Stopped');/CODE]
and after StopThread my programm buzzed!
Why?
 
Unfortunately I do not see any answers :(
I have found a new very simple example of a problem.
if StopThread method is called in OnThreadError event then the program does not work further.
The code:


Code:
procedure TForm1.Button1Click(Sender: TObject);
begin
  OracleQueue1.StartThread;
end;

procedure TForm1.OracleQueue1ThreadError(Sender: TOracleQueue;
  ErrorCode: Integer; const ErrorMessage: String);
begin
  OracleQueue1.StopThread;
end;
This is all code in my application!
 
You can't call StopThread from withing the OnThreadError event handler. It runs in the same thread, so you get a thread deadlock.
 
can't?!

Quote from your help system:

"TOracleQueue.OnThreadError

[skipped]
You can call the StopThread procedure within this event handler if you do not want to continue to wait for additional messages."

By the way, I have updated the DOA version to 4.0.7.1 and I hope my problems will be solved.
 
...and how I can stop processing withing OnThreadError? For example, if I recieved critical error and need to stop?
 
I think that is a documentation error. The thread cannot stop itself. Only another thread can call StopThread.
 
Back
Top