'Flush the outbound buffer.'

def flush(self, errors=True, groups=True):

    if errors:
        buf = list(self._outbound_buffer)
        try:
            with self.mutex:
                for (event, routing_key, _) in buf:
                    self._publish(event, self.producer, routing_key)
        finally:
            self._outbound_buffer.clear()
    if groups:
        with self.mutex:
            for (group, events) in items(self._group_buffer):
                self._publish(events, self.producer, (u'%s.multi' % group))
                events[:] = []
