GetFirst (TStereotypeClassQueue)
De Wiki1000
class function GetFirst(const iTopic:string):TQueueObject;
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 :
//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;
Voir aussi