Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XMKPLQ

XMKPLQ.m

Go to the documentation of this file.
  1. XMKPLQ ;ISC-SF/GMB-Post local msgs to correct queues ;07/28/2000 14:34
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ; Replaces ^XMADJF0, ZTSK^XMADGO (ISC-WASH/CAP)
  1. GO ;
  1. ; Variables provided through TASKMAN: XMHANG
  1. N XMACTIVE,XMUID,XMQLIST,XMTSTAMP,XMGROUP,XMCNT,XMQUEUE,XMREC
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. L +^XMBPOST("POST_Mover"):1 E Q
  1. I $D(ZTQUEUED) S %=$$PSET^%ZTLOAD(ZTSK)
  1. S XMACTIVE=$$TSTAMP^XMXUTIL1
  1. F D Q:$P($G(^XMB(1,1,0)),U,16)
  1. . D GETQ(.XMQLIST) ; Get new parameters for grouping
  1. . S XMTSTAMP=""
  1. . F S XMTSTAMP=$O(^XMBPOST("BOX",XMTSTAMP)) Q:XMTSTAMP="" D Q:$$TSTAMP^XMXUTIL1-XMACTIVE>30
  1. . . S XMGROUP=""
  1. . . F S XMGROUP=$O(^XMBPOST("BOX",XMTSTAMP,XMGROUP)) Q:XMGROUP="" D
  1. . . . S XMUID=0
  1. . . . F S XMUID=$O(^XMBPOST("BOX",XMTSTAMP,XMGROUP,XMUID)) Q:XMUID="" S XMREC=^(XMUID) D
  1. . . . . S XMCNT=+XMREC
  1. . . . . S XMQUEUE=$$WHICHQ(XMQLIST(XMGROUP),XMCNT)
  1. . . . . I XMGROUP="M" D
  1. . . . . . D MQUEUE(XMTSTAMP,XMUID,XMQUEUE,XMREC)
  1. . . . . E D
  1. . . . . . D RQUEUE(XMTSTAMP,XMUID,XMQUEUE,XMREC)
  1. . . . . D STATS(XMGROUP,XMQUEUE,XMCNT)
  1. . . . . K ^XMBPOST("BOX",XMTSTAMP,XMGROUP,XMUID)
  1. . I $$TSTAMP^XMXUTIL1-XMACTIVE>30 D Q
  1. . . D ZTSK
  1. . . S XMACTIVE=$$TSTAMP^XMXUTIL1
  1. . H XMHANG
  1. L -^XMBPOST("POST_Mover")
  1. I $D(ZTQUEUED) D PCLEAR^%ZTLOAD(ZTSK)
  1. Q
  1. GETQ(XMQLIST) ;
  1. N X
  1. S X=$G(^XMB(1,1,6))
  1. S XMQLIST("M")=$P(X,U),XMQLIST("R")=$P(X,U,2)
  1. Q
  1. WHICHQ(XMQLIST,XMCNT) ;
  1. N XMQUEUE,XMQLEN
  1. I XMQLIST'["," Q 1
  1. S XMQLEN=$L(XMQLIST,",")
  1. F XMQUEUE=1:1:$L(XMQLIST,",") Q:XMCNT<$P(XMQLIST,",",XMQUEUE)
  1. Q $S(XMCNT<$P(XMQLIST,",",XMQUEUE):XMQUEUE,1:XMQUEUE+1)
  1. RQUEUE(XMTSTAMP,XMUID,XMQUEUE,XMREC) ; Put replies into queue
  1. N XMZ,XMTSQ
  1. ;If the response is already in the queue, find out its Timestamp
  1. ;and file the new response right next to it.
  1. S XMZ=$P(XMUID,U,1)
  1. S XMTSQ=$O(^XMBPOST("R",XMQUEUE,"B",XMZ,0))
  1. I XMTSQ S XMTSTAMP=XMTSQ
  1. E S ^XMBPOST("R",XMQUEUE,"B",XMZ,XMTSTAMP)=""
  1. S ^XMBPOST("R",XMQUEUE,XMTSTAMP,XMZ,$P(XMUID,U,2))=XMREC
  1. Q
  1. MQUEUE(XMTSTAMP,XMUID,XMQUEUE,XMREC) ; Put new & forwarded messages into queue
  1. S ^XMBPOST("M",XMQUEUE,XMTSTAMP,XMUID)=XMREC
  1. Q
  1. STATS(XMGROUP,XMQUEUE,XMCNT) ;
  1. N XMSTATS
  1. L +^XMBPOST("QSTATS",XMGROUP,XMQUEUE)
  1. S XMSTATS=$G(^XMBPOST(XMGROUP,XMQUEUE)),^(XMQUEUE)=($P(XMSTATS,U,1)+1)_U_($P(XMSTATS,U,2)+XMCNT)
  1. L -^XMBPOST("QSTATS",XMGROUP,XMQUEUE)
  1. Q
  1. ZTSK ; START Delivery Background Processes
  1. Q:$P(^XMB(1,1,0),U,16) ;Quit if Background Filer Stop Flag
  1. N XMGROUP,XMQUEUE,ZTRTN,ZTSAVE,ZTDESC
  1. F XMGROUP="M","R" D ; Check each queue for messages
  1. . S XMQUEUE=""
  1. . F S XMQUEUE=$O(^XMBPOST(XMGROUP,XMQUEUE)) Q:XMQUEUE'>0 D
  1. . . Q:$D(^XMBPOST(XMGROUP,XMQUEUE))<10 ; Quit if nothing in queue
  1. . . L +^XMBPOST(XMGROUP,XMQUEUE):1 E Q ; If node locked, there is already one running
  1. . . S (ZTSAVE("XMGROUP"),ZTSAVE("XMQUEUE"),ZTSAVE("XMHANG"))=""
  1. . . S ZTDESC=$$EZBLD^DIALOG($S(XMGROUP="M":36230,1:36231),XMQUEUE) ; MailMan: Message/Response Delivery Queue |1|
  1. . . S ZTRTN="GO^XMTDL"
  1. . . D TASKIT(ZTRTN,ZTDESC,.ZTSAVE) H 0 ; Start a job, Give TaskMan a chance to start it (hang)
  1. . . L -^XMBPOST(XMGROUP,XMQUEUE)
  1. Q
  1. TASKIT(ZTRTN,ZTDESC,ZTSAVE) ;
  1. N X,ZTSK,ZTQUEUED,ZTCPU,ZTDTH,ZTIO
  1. I '$D(ZTCPU),$D(^XMB(1,1,0)) S X=$P(^(0),U,12) I X'="" S ZTCPU=$P(X,",",2)
  1. S ZTIO="",ZTDTH=$H
  1. D ^%ZTLOAD
  1. Q
  1. JOB ;Start background filer when TaskMan can't
  1. JOBGO S IO="",IO(0)="" D DT^DICRW G GO^XMTDL
  1. Q
  1. CHKQ ; Input transform for file 4.3, fields 241 and 242
  1. K:$L(X)>120!($L(X)<1) X Q:'$D(X)
  1. K:X'?1.N.9(1","1.N) X Q:'$D(X)
  1. N I
  1. F I=1:1:$L(X,",")-1 I $P(X,",",I)'<$P(X,",",I+1) K X Q
  1. Q
  1. HELPQ ; Executable help for file 4.3, fields 241 and 242
  1. ;You determine the number of delivery queues (10 max.) ...
  1. N XMTEXT
  1. D BLD^DIALOG(36232,"","","XMTEXT","F")
  1. D MSG^DIALOG("WM","",79,"","XMTEXT")
  1. Q