Both Reader and Nsqd classes expose various signals provided by the Blinker library.

Subscribing to signals

To subscribe to a signal, you can use the connect() method of a signal. The first argument is the function that should be called when the signal is emitted, the optional second argument specifies a sender. To unsubscribe from a signal, you can use the disconnect() method.

def error_handler(reader, error):
    print 'Got an error:', error


You can also easily subscribe to signals by using connect() as a decorator:

def handle_giving_up(reader, message):
    print 'Giving up on:',