Beispiel #1
0
def module_unpack(txn, data):
    print "data: %s" % data,
    Logger.info('5', 'receive data: {}'.format(data))
    example_msg = txn.data()
    example_msg.data = data

    return len(data)
Beispiel #2
0
def module_unpack(txn, data):
    print "py module unpack"
    Logger.info('5', 'receive data: {}'.format(data))

    # Store data into txn sharedData
    example_msg = txn.data()
    example_msg.data = data
    return len(data)
Beispiel #3
0
def module_init(config):
    print "py module init"

    Logger.trace('py module init: trace test')
    Logger.debug('py module init: debug test')
    Logger.info('1', 'py module init: info test')
    Logger.warn('2', 'py module init: warn test', 'no suggestion')
    Logger.error('3', 'py module init: error test', 'no solution')
    Logger.fatal('4', 'py module init: fatal test', 'no solution')
    return
Beispiel #4
0
def module_pack(txn, txndata):
    mod_metrics = Metrics.module()
    mod_metrics.response.inc(1)

    mod_dymetrics = Metrics.transaction('test')
    mod_dymetrics.response.inc(1)

    if txn.status() != Txn.Txn.TXN_OK:
        txndata.append('error')
        Logger.error('6', 'module_pack error', 'no solution')
    else:
        example_msg = txn.data()
        print "pack data: %s" % example_msg.data
        Logger.info('7', 'module_pack: data sz: {}'.format(len(example_msg.data)))

        txndata.append(example_msg.data)
Beispiel #5
0
def module_pack(txn, txndata):
    print "py module pack"

    # Increase counters
    mod_metrics = Metrics.module()
    mod_metrics.response.inc(1)

    mod_dymetrics = Metrics.transaction('test')
    mod_dymetrics.response.inc(1)

    # Assemble response
    if txn.status() != Txn.Txn.TXN_OK:
        txndata.append('error')
    else:
        example_msg = txn.data()
        print "pack data: %s" % example_msg.data
        Logger.info('7',
                    'module_pack: data sz: {}'.format(len(example_msg.data)))

        txndata.append(example_msg.data)