Start publishing MySQL row-based binlog events to blinker signals

    Args:
        mysql_settings (dict): information to connect to mysql via pymysql
        **kwargs: The additional kwargs will be passed to
        :py:class:`pymysqlreplication.BinLogStreamReader`.

def start_publishing(mysql_settings, **kwargs):
    """Start publishing MySQL row-based binlog events to blinker signals

    Args:
        mysql_settings (dict): information to connect to mysql via pymysql
        **kwargs: The additional kwargs will be passed to
        :py:class:`pymysqlreplication.BinLogStreamReader`.
    """
    _logger.info('Start publishing from %s with:\n%s'
                 % (mysql_settings, kwargs))

    kwargs.setdefault('server_id', random.randint(1000000000, 4294967295))
    kwargs.setdefault('freeze_schema', True)

    # connect to binlog stream
    stream = pymysqlreplication.BinLogStreamReader(
        mysql_settings,
        only_events=[row_event.DeleteRowsEvent,
                     row_event.UpdateRowsEvent,
                     row_event.WriteRowsEvent],
        **kwargs
    )
    """:type list[RowsEvent]"""

    for event in stream:
        # ignore non row events
        if not isinstance(event, row_event.RowsEvent):
            continue

        _logger.debug('Send binlog signal "%s@%s.%s"' % (
            event.__class__.__name__,
            event.schema,
            event.table
        ))
        signals.binlog_signal.send(event, stream=stream)
        signals.binlog_position_signal.send((stream.log_file, stream.log_pos))