GetFirst (TStereotypeClassQueue)
<source lang='delphi'>class function GetFirst(const iTopic:string):TQueueObject;</source>
Cette fonction retourne le premier objet prêt de la file d'attente sans le consommer.
| Result | Le premier objet non consommée de la file pour le sujet. |
| iTopic | Nom de sujet demandé. |
Exemple :
<source lang='delphi'>
//Procedure TestInQueue; var sel:TSelector; obj,todo:MyQueue; inst:WFClasseA; S,stag:string; begin
sel := WFClasseA.CreateSelector('unEntier>%1',,true,[10]);
sel.InQueue('MyQueue','wfclassea/@oid');
S := ; stag := ;
obj := MyQueue.GetFirst();
Repeat
if Assigned(obj) then
begin
// We can do some check on the actual topic of the queue object
// we keep obj for the GetNext, so we used an other instance
todo := MyQueue.deQueue(obj.queueTopic);
// the object may has been consumed by an other process, so we have to check it again.
if Assigned(todo) then
begin
inst := todo.queueRef as WFClasseA;
if Assigned(inst) then
try
// This is a test case for requeue capability
if inst.unEntier=21 then raise Exception.Create('check error');
//
S := S+stag+inst.unCode;
stag := ',';
// delete this queue object
todo.DeleteThisObject;
except
// on error requeue the object with the same topic
// The object will not been retreive in the next loop turn because of the GetNext
todo.ReQueue();
end;
end;
end;
//
obj := MyQueue.GetNext(,obj);
Until not Assigned(obj);
showMessage(S);
end; </source>
Voir aussi
{{#if:Classe_file_d'attente_(stereotype)|
{{#if:Classe_file_d'attente_(stereotype)|— Classe_file_d'attente_(stereotype) |}} — Développement DSM —
|
{{#if:|— [[{{{1}}}]] |}} — Développement DSM —
}}