Module taos.tmq

Expand source code
from taos.cinterface import *
from taos.error import *
from taos.result import *

class TaosTmqConf(object):
    def __init__(self):
        self._conf = tmq_conf_new()
        
    def set(self, key, value):
        tmq_conf_set(self._conf, key, value)
        
    def set_auto_commit_cb(self, cb, param):
        tmq_conf_set_auto_commit_cb(self._conf, cb, param)
    
    def __del__(self):
        tmq_conf_destroy(self._conf)
        
    def new_consumer(self):
        return TaosTmq(self)

    def conf(self):
        return self._conf
    
class TaosTmq(object):
    def __init__(self, conf):
        self._tmq  = tmq_consumer_new(conf.conf())
        
    def subscribe(self, list):
        tmq_subscribe(self._tmq, list.list())
        
    def unsubscribe(self):
        tmq_unsubscribe(self._tmq)
        
    def subscription(self):
        return tmq_subscription(self._tmq)
        
    def poll(self, time):
        result = tmq_consumer_poll(self._tmq, time)
        if result:
            return TaosResult(result)
        else:
            return None
        
    def __del__(self):
        tmq_consumer_close(self._tmq)
        
    def commit(self, offset, _async):
        tmq_commit(self._tmq, offset, _async)
        
        
class TaosTmqList(object):
    def __init__(self):
        self._list = tmq_list_new()
        
    def append(self, topic):
        tmq_list_append(self._list, topic)
    
    def __del__(self):
        tmq_list_destroy(self._list)
        
    def to_array(self):
        return tmq_list_to_c_array(self._list)
        
    
    def list(self):
        return self._list

Classes

class TaosTmq (conf)
Expand source code
class TaosTmq(object):
    def __init__(self, conf):
        self._tmq  = tmq_consumer_new(conf.conf())
        
    def subscribe(self, list):
        tmq_subscribe(self._tmq, list.list())
        
    def unsubscribe(self):
        tmq_unsubscribe(self._tmq)
        
    def subscription(self):
        return tmq_subscription(self._tmq)
        
    def poll(self, time):
        result = tmq_consumer_poll(self._tmq, time)
        if result:
            return TaosResult(result)
        else:
            return None
        
    def __del__(self):
        tmq_consumer_close(self._tmq)
        
    def commit(self, offset, _async):
        tmq_commit(self._tmq, offset, _async)

Methods

def commit(self, offset, _async)
Expand source code
def commit(self, offset, _async):
    tmq_commit(self._tmq, offset, _async)
def poll(self, time)
Expand source code
def poll(self, time):
    result = tmq_consumer_poll(self._tmq, time)
    if result:
        return TaosResult(result)
    else:
        return None
def subscribe(self, list)
Expand source code
def subscribe(self, list):
    tmq_subscribe(self._tmq, list.list())
def subscription(self)
Expand source code
def subscription(self):
    return tmq_subscription(self._tmq)
def unsubscribe(self)
Expand source code
def unsubscribe(self):
    tmq_unsubscribe(self._tmq)
class TaosTmqConf
Expand source code
class TaosTmqConf(object):
    def __init__(self):
        self._conf = tmq_conf_new()
        
    def set(self, key, value):
        tmq_conf_set(self._conf, key, value)
        
    def set_auto_commit_cb(self, cb, param):
        tmq_conf_set_auto_commit_cb(self._conf, cb, param)
    
    def __del__(self):
        tmq_conf_destroy(self._conf)
        
    def new_consumer(self):
        return TaosTmq(self)

    def conf(self):
        return self._conf

Methods

def conf(self)
Expand source code
def conf(self):
    return self._conf
def new_consumer(self)
Expand source code
def new_consumer(self):
    return TaosTmq(self)
def set(self, key, value)
Expand source code
def set(self, key, value):
    tmq_conf_set(self._conf, key, value)
def set_auto_commit_cb(self, cb, param)
Expand source code
def set_auto_commit_cb(self, cb, param):
    tmq_conf_set_auto_commit_cb(self._conf, cb, param)
class TaosTmqList
Expand source code
class TaosTmqList(object):
    def __init__(self):
        self._list = tmq_list_new()
        
    def append(self, topic):
        tmq_list_append(self._list, topic)
    
    def __del__(self):
        tmq_list_destroy(self._list)
        
    def to_array(self):
        return tmq_list_to_c_array(self._list)
        
    
    def list(self):
        return self._list

Methods

def append(self, topic)
Expand source code
def append(self, topic):
    tmq_list_append(self._list, topic)
def list(self)
Expand source code
def list(self):
    return self._list
def to_array(self)
Expand source code
def to_array(self):
    return tmq_list_to_c_array(self._list)