Description
This is the method that contains the call to the specific method in the appropriate class to perform the request.
This method should be extended on the specific daemon level.
In order to have a proper logging of the errors/warnings you get from the business method that is used for processing the work, you need to fill in tPassMessages temp-table parameter, as a copy of tFcMessages from the called business component.
Parameters
iiDaemonQueueId | input | integer | ID of the daemon queue record that indicates the work that needs to be done. |
olSuccess | output | logical | Was the operation successful? |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program/btimeoutdaemonprocessor.p)
<ANCESTOR-CODE>
/* ================================================= */
/* Find the fcDaemonQueue request we need to process */
/* ================================================= */
<Q-4 run GetDaemonQueueInfo (all) (Read) (NoCache)
(input iiDaemonQueueId, (DaemonQueueId)
output dataset tqGetDaemonQueueInfo) in BBaseDaemonQueue>
find tqGetDaemonQueueInfo where
tqGetDaemonQueueInfo.tiDaemonQueueId = iiDaemonQueueId
no-lock no-error.
if not available tqGetDaemonQueueInfo
then do:
assign vcMsg = trim(#T-1'TimeOut-Daemon Queue record not found.':100(8535)T-1#) + chr(10) +
trim(substitute('DaemonQueueID = &1.':U, trim(string(iiDaemonQueueId))))
oiReturnStatus = -3.
<M-5 run SetMessage
(input vcMsg (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'BLF-224':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BTimeOutDaemonProcessor>
return.
end. /* if not avail tqGetDaemonQueueInfo */
/* =========================================================================== */
/* Get the ID of the CB-Session out of the DaemonQueueRef field of the request */
/* =========================================================================== */
assign viTempSessionInstanceId = integer (substring(tqGetDaemonQueueInfo.tcDaemonQueueRef,length("TIMEOUT","CHARACTER") + 1,-1,"CHARACTER")) no-error.
if viTempSessionInstanceId = ?
then assign viTempSessionInstanceId = 0.
/* ============================================================================================================= */
/* Find out if the session is still active and if so, take additional actions for the non-CB side of the session */
/* ============================================================================================================= */
if viTempSessionInstanceId = 0
then vlIsActive = no.
else do:
<Q-6 run FcSessionByAll (all) (Read) (NoCache)
(input viTempSessionInstanceId, (SessionInstanceId)
input ?, (GlobalSessionNeedsUpdate)
output dataset tqFcSessionByAll) in BFcSession>
Find First tqFcSessionByAll No-error.
/* If there is no CB-Session anymore then just indicate that this methos was succesfull and return */
If Not Available tqFcSessionByAll
Then Do:
Assign olSuccess = True
oiReturnStatus = 0.
Return.
End. /* If Not Available tqFcSessionByAll */
/* Call KeepAlive, either on QRA, either on the Mfg-side */
if com.qad.qra.config.QraConfig:IsEnabled
then do:
<I-3 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "False"
&CLASS = "PAuthenticationQRA"}>
<M-2 run KeepAlive
(input tqFcSessionByAll.tcGlobalSessionId (icGlobalSessionId),
input yes (ilUpdateSession),
output vlIsActive (olIsActive),
output viFcReturnSuper (oiReturnStatus)) in PAuthenticationQRA>
<I-87 {bFcCloseAndStopInstance
&CLASS = "PAuthenticationQRA"}>
end. /* if com.qad.qra.config.QraConfig:IsEnabled */
else do:
<I-10 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "False"
&CLASS = "PAuthentication"}>
<M-12 run KeepAlive
(input tqFcSessionByAll.tcGlobalSessionId (icGlobalSessionId),
input yes (ilUpdateSession),
output vlIsActive (olIsActive),
output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
<I-11 {bFcCloseAndStopInstance
&CLASS = "PAuthentication"}>
end. /* Not if com.qad.qra.config.QraConfig:IsEnabled */
/* Mark as inactive in case errors occur4ed in the KeepAlive-call but do not raise an error for this method */
If viFcReturnSuper < 0
Then vlIsActive = no.
end. /* Not if viTempSessionInstanceId = 0 */
/* ============================================================================================ */
/* Further actions on fcSession depending on whether the overall session is still active or not */
/* ============================================================================================ */
If vlIsActive
Then Do:
/* Update the fields in the fcSession record about when to check all this again */
<M-24 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in BTimeOutDaemonProcessor>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
/* The timeout daemon must always use UTC */
session:timezone = 0.
Assign vcQuery = "for each fcSession where fcSession.SessionInstance_ID = ":U + String(viTempSessionInstanceId).
<M-25 run WriteDirect
(input 'fcSession':U (icTableName),
input vcQuery (icPrepare),
input 'GlobalSessionNeedsUpdate,GlobalSessionLastCheckTime,GlobalSessionLastCheckDate':U (icFieldList),
input 'l,i,t':U (icFieldListDataTypes),
input 'false' + chr(2) + string(Time) + chr(2) + string(Today) (icAbsolute),
input '' (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in persistence>
session:timezone = viTimeOffset.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
/* Mark this method as succesfull */
Assign olSuccess = True.
End. /* If vlIsActive */
Else Do:
/* Delete the fcSession record in case it still exists - no error in case it no longer exists (-4) */
<M-22 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in BTimeOutDaemonProcessor>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
Assign vcQuery = "for each fcSession where fcSession.SessionInstance_ID = ":U + String(viTempSessionInstanceId).
<M-23 run WriteDirect
(input 'fcSession':U (icTableName),
input vcQuery (icPrepare),
input '' (icFieldList),
input '' (icFieldListDataTypes),
input '' (icAbsolute),
input '' (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in persistence>
if viFcReturnSuper = -4
then assign viFcReturnSuper = 0.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
/* Mark this method as succesfull */
Assign olSuccess = True.
End. /* Not If vlIsActive */