def create_consumer(user, password, config_file_path, process_message, *args, **kwargs):
    '''Create a pulse consumer. Call listen() to start listening.'''
    queue_config = _read_json_file(filepath=config_file_path)

    exchanges = map(lambda x: queue_config['sources'][x]['exchange'], queue_config['sources'].keys())
    topics = map(lambda x: queue_config['sources'][x]['topic'], queue_config['sources'].keys())

    for i in range(0, len(exchanges)):
        LOG.info('Listening to (%s, %s)' % (exchanges[i], topics[i]))

    pulse_args = {
        # If the queue exists and is durable it should match
        'durable': queue_config['durable'] in ('true', 'True'),
        'password': password,
        'topic': topics,
        'user': user
    }

    if queue_config.get('applabel') is not None:
        pulse_args['applabel'] = queue_config['applabel']

    return PulseReplayConsumer(
        # A list with the exchanges of each element under 'sources'
        exchanges=exchanges,
        callback=process_message,
        **pulse_args
    )
    return consumer
Create a pulse consumer. Call listen() to start listening.