Example #1
0
def get_user_groups_db_kafka_pillow(pillow_id):
    # note: this is temporarily using ConstructedPillow as a test. If it is successful we should
    # flip the main one over as well
    user_groups_couch_db = couch_config.get_db_for_class(CommCareUser)
    kafka_client = get_kafka_client_or_none()
    processor = KafkaProcessor(
        kafka_client, data_source_type=data_sources.COUCH, data_source_name=user_groups_couch_db.dbname
    )
    checkpoint = PillowCheckpoint(pillow_id)
    return ConstructedPillow(
        name=pillow_id,
        document_store=None,  # because we're using include_docs we can be explicit about not using this
        checkpoint=checkpoint,
        change_feed=CouchChangeFeed(user_groups_couch_db, include_docs=True),
        processor=processor,
        change_processed_event_handler=PillowCheckpointEventHandler(
            checkpoint=checkpoint, checkpoint_frequency=100,
        ),
    )
Example #2
0
def get_application_db_kafka_pillow(pillow_id, **kwargs):
    from corehq.apps.app_manager.models import Application
    return get_change_feed_pillow_for_db(
        pillow_id, couch_config.get_db_for_class(Application), topics.APP)
Example #3
0
def get_domain_db_kafka_pillow(pillow_id, **kwargs):
    return get_change_feed_pillow_for_db(pillow_id,
                                         couch_config.get_db_for_class(Domain),
                                         topics.DOMAIN)
Example #4
0
def get_user_groups_db_kafka_pillow(pillow_id, **kwargs):
    return get_change_feed_pillow_for_db(
        pillow_id, couch_config.get_db_for_class(CommCareUser),
        topics.COMMCARE_USER)
Example #5
0
def get_application_db_kafka_pillow(pillow_id, **kwargs):
    from corehq.apps.app_manager.models import Application
    return get_change_feed_pillow_for_db(pillow_id, couch_config.get_db_for_class(Application))
Example #6
0
def get_domain_db_kafka_pillow(pillow_id, **kwargs):
    return get_change_feed_pillow_for_db(pillow_id, couch_config.get_db_for_class(Domain))
Example #7
0
def get_user_groups_db_kafka_pillow(pillow_id, **kwargs):
    return get_change_feed_pillow_for_db(pillow_id, couch_config.get_db_for_class(CommCareUser))
Example #8
0
def get_application_blob_deletion_pillow(pillow_id):
    """Get blob deletion pillow for the apps couch database"""
    couch_db = couch_config.get_db_for_class(Application)
    return _get_blob_deletion_pillow(pillow_id, couch_db)
Example #9
0
def get_domain_db_kafka_pillow(pillow_id):
    return get_change_feed_pillow_for_db(pillow_id,
                                         couch_config.get_db_for_class(Domain))
Example #10
0
def get_user_groups_db_kafka_pillow(pillow_id):
    return get_change_feed_pillow_for_db(
        pillow_id, couch_config.get_db_for_class(CommCareUser))
Example #11
0
def get_application_blob_deletion_pillow(pillow_id):
    """Get blob deletion pillow for the apps couch database"""
    couch_db = couch_config.get_db_for_class(Application)
    return _get_blob_deletion_pillow(pillow_id, couch_db)