Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The function blocks described in this section can only be used in Python agents in batch workflows. The available function blocks are:

  • beginBatch

  • drain

  • endBatch

  • endBatchHinted

  • cancelBatch

  • splittingBatch

  • commit

  • rollback

beginBatch

Note
title

Note!

This function block only applies for the Python processing agent.

...

Code Block
def beginBatch()
title
Info

Example - beginBatch function block


Code Block
def beginBatch():
    debug('beginBatch called')


drain

Note
title

Note!

This function block only applies for the Python processing agent.

...

Code Block
def drain()


Info
title

Example - drain function block


Code Block
def drain():
    debug('drain called')
    udrRoute(myLastUDR) 


endBatch 

title
Note

Note!

This function block only applies for the Python processing agent.

...

Code Block
def endBatch()
title
Info

example - endBatch function block


Code Block
def endBatch():
    debug('endBatch called')


endBatchHinted

title
Note

Note!

This function block only applies for the Python collection agent.

This function block is called when another agent has called hintEndBatch. The collection agent may choose to ignore this method, that is, not to implement it if it cannot be supported.

Code Block
def endBatchHinted()
title
Info

Example - endBatchHinted function block


Code Block
def endBatchHinted():
    debug('endBatchHinted called')


cancelBatch

This function block is executed if a Cancel Batch is emitted anywhere in the workflow.

Code Block
def cancelBatch()
Info
title

Exampel - cancelBatch function block


Code Block
def cancelBatch():
    debug('cancelBatch called')


splittingBatch

Note
title

Note!

This function block only applies for the Python processing agent.

This function block is called when the collection agent has split the input batch. If the agent keeps internal buffers to be flushed differently depending on the nature of the transaction, this method serves as a hint to the drain call.

Code Block
def splittingBatch()
Info
title

Example - splittingBatch function block


Code Block
def splittingBatch():
    debug('splittingBatch called')


commit

This function block is executed for each batch when the transaction is successful. If the commit block fails with an exception, it will be executed again until it succeeds.

Code Block
def commit()
title
Info

Example - commit function block


Code Block
isRecoveryCommit = True

def initialize():
    debug('initialize called')

def beginBatch():
    global isRecoveryCommit
    isRecoveryCommit = False

def commit():
    if isRecoveryCommit:
        debug('this is a recovery commit, it is executed immediately after initialize')
    else:
        debug('this is a normal commit')


rollback

This function block is executed for a batch if it fails.

Code Block
def rollback()
title
Info

Example - rollback function block


Code Block
def rollback():
    debug('rollback called')


...