示例#1
0
    def __init__(self, *args, **kwargs):
        options = {'since': _getLastSavedSequence()}
        log.debug("\n\n-----" + pprint.pformat(options) + "------\n\n")
        self.resourceDataChangeMonitor = MonitorChanges(
            appConfig['couchdb.url.dbadmin'],
            appConfig['couchdb.db.resourcedata'],
            _RESOURCE_DATA_CHANGE_HANDLERS, options)
        self.resourceDataChangeMonitor.start()

        self.incomingChangeMonitor = MonitorChanges(
            appConfig['couchdb.url.dbadmin'], incomingDB,
            _INCOMING_CHANGE_HANDLERS, {'since': -1})
        self.incomingChangeMonitor.start()

        #changeMonitor.start(threading.current_thread())
        def atExitHandler():

            self.resourceDataChangeMonitor.terminate()
            self.incomingChangeMonitor.terminate()
            log.debug("Last change in Resource Data: {0}\n\n".format(
                self.resourceDataChangeMonitor._lastChangeSequence))
            log.debug("Last change in Incoming: {0}\n\n".format(
                self.incomingChangeMonitor._lastChangeSequence))

        atexit.register(atExitHandler)
示例#2
0
    def __init__(self, *args, **kwargs):
        options = {'since':_getLastSavedSequence()}
        log.debug("\n\n-----"+pprint.pformat(options)+"------\n\n")
        
        self.resourceDataChangeMonitor = MonitorChanges(appConfig['couchdb.url.dbadmin'], 
                                                            appConfig['couchdb.db.resourcedata'],
                                                            _RESOURCE_DATA_CHANGE_HANDLERS,
                                                            options)
        self.resourceDataChangeMonitor.start()
            
        self.incomingChangeMonitor = MonitorChanges(appConfig['couchdb.url.dbadmin'], 
                                                            incomingDB,
                                                            _INCOMING_CHANGE_HANDLERS,
                                                            {'since':-1})
        self.incomingChangeMonitor.start()
        

        #changeMonitor.start(threading.current_thread())
        def atExitHandler():
            
            self.resourceDataChangeMonitor.terminate()
            self.incomingChangeMonitor.terminate()
            log.debug("Last change in Resource Data: {0}\n\n".format(self.resourceDataChangeMonitor._lastChangeSequence))        
            log.debug("Last change in Incoming: {0}\n\n".format(self.incomingChangeMonitor._lastChangeSequence))

        atexit.register(atExitHandler)
示例#3
0
def monitorResourceDataChanges():
    options = {"since": _getLastSavedSequence()}
    log.debug("\n\n-----" + pprint.pformat(options) + "------\n\n")

    changeMonitor = MonitorChanges(
        appConfig["couchdb.url"], appConfig["couchdb.db.resourcedata"], _RESOURCE_DATA_CHANGE_HANDLERS, options
    )
    changeMonitor.start()

    # changeMonitor.start(threading.current_thread())
    def atExitHandler():
        changeMonitor.terminate()
        log.debug("Last change {0}\n\n".format(changeMonitor._lastChangeSequence))

    atexit.register(atExitHandler)
示例#4
0
def monitorResourceDataChanges():
    options = {'since': _getLastSavedSequence()}
    log.debug("\n\n-----" + pprint.pformat(options) + "------\n\n")

    changeMonitor = MonitorChanges(appConfig['couchdb.url'],
                                   appConfig['couchdb.db.resourcedata'],
                                   _RESOURCE_DATA_CHANGE_HANDLERS, options)
    changeMonitor.start()

    #changeMonitor.start(threading.current_thread())
    def atExitHandler():
        changeMonitor.terminate()
        log.debug("Last change {0}\n\n".format(
            changeMonitor._lastChangeSequence))

    atexit.register(atExitHandler)