def sendURBS(): if convid and convid not in ( 'NEW', 'ANY', 'NONE'): # OLD, ANY, don't work Invalid convid 002000185 bb.conv_id = convid print('Get last uow') try: bb.syncpoint(option=OPT_LAST) except BrokerError: if bb.error_code == '00780305': # No matching UOW found print('\nNo matching UOW found\n') else: print( 'BrokerError exception in sendURBS() at synpoint(option=last)' ) raise else: bb.conv_id = convid print('Sending TEST URBS') reptor.makeURBH(bb.send_buffer, msgNo=1) slen = reptor.makeURBS() bb.send_length = slen bb.send(option=OPT_COMMIT) sys.exit(0)
def reqInst(rdest='', token='', instname='', dbid=0, fnr=[], isnl=[], value=''): global bb, acode, wcode, arc if acode == '' and wcode == '' and arc == 2: arcd = 0 else: arcd = arc reptor.makeURBH(bb.send_buffer, msgNo=msgn) for f in fnr: print('file', f) slen = reptor.requestInst(rspDest=rdest, token=token, instname=instname, dbid=dbid, fnr=f, isnl=isnl, value=value, arc=arcd, acode=acode, wcode=wcode) bb.send_length = slen bb.send(conv_id='NEW', option=OPT_COMMIT)
def reqClose(dest='', rdest='', token=''): global bb reptor.makeURBH(bb.send_buffer, msgNo=msgn) slen = reptor.requestCloseDest(token=token, destination=dest, rspDest=rdest) bb.send_length = slen bb.send(conv_id='NEW', option=OPT_COMMIT)
def reqStatus(dest='', rdest='', subs='', token=''): global bb reptor.makeURBH(bb.send_buffer, msgNo=msgn) slen = reptor.requestStatus(token=token, destination=dest, subscription=subs, rspDest=rdest) bb.send_length = slen bb.send(conv_id='NEW', option=OPT_COMMIT)
def reqPrior(dest='', rdest='', subs='', token='', tseq=0): global bb reptor.makeURBH(bb.send_buffer, msgNo=msgn) slen = reptor.requestPriorTrans(token=token, destination=dest, subscription=subs, rspDest=rdest, transSeqno=tseq) bb.send_length = slen bb.send(conv_id='NEW', option=OPT_COMMIT)
def chunked(rdest='', token='', instname='', dbid=0, fnr=[], maxisn=0, chunks=0, talog=''): global bb, acode, wcode, arc, msgn if acode == '' and wcode == '' and arc == 2: arcd = 0 else: arcd = arc fd = open(talog) # open Targe Adapter log file loglines = follow(fd) # lines generator for i in range(1, maxisn + 1, chunks): reptor.makeURBH(bb.send_buffer, msgNo=msgn) isnl = ([i, min(i + chunks - 1, maxisn)], ) # a list in a list slen = reptor.requestInst(rspDest=rdest, token=token, instname=instname, dbid=dbid, fnr=fnr[0], isnl=isnl, arc=arcd, acode=acode, wcode=wcode) bb.send_length = slen bb.send(conv_id='NEW', option=OPT_COMMIT) msgn += 1 for line in loglines: if IS_ended(line, instname): break # try to start next initial state