diff --git a/.devcontainer/.dev_config.yaml b/.devcontainer/.dev_config.yaml index 2c2e35c..3c74b5d 100644 --- a/.devcontainer/.dev_config.yaml +++ b/.devcontainer/.dev_config.yaml @@ -10,7 +10,7 @@ searchable_classes: name: Study Type - key: "study.project.alias" # a property part of a deeply embedded resource name: Project Alias -searchable_resource_events_topic: searchable_resource_events +resource_change_event_topic: searchable_resource_events resource_deletion_event_type: searchable_resource_deleted resource_upsertion_event_type: searchable_resource_upserted service_instance_id: 001 diff --git a/README.md b/README.md index 260560b..fa6560f 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ The service requires the following configuration parameters: - **Additional Properties**: Refer to *#/definitions/SearchableClass*. -- **`searchable_resource_events_topic`** *(string)*: Name of the event topic used to track searchable resource deletion and upsertion events. +- **`resource_change_event_topic`** *(string)*: Name of the event topic used to track resource deletion and upsertion events. - **`resource_deletion_event_type`** *(string)*: The type to use for events with deletion instructions. diff --git a/config_schema.json b/config_schema.json index cabec89..52b80f3 100644 --- a/config_schema.json +++ b/config_schema.json @@ -14,12 +14,12 @@ "$ref": "#/definitions/SearchableClass" } }, - "searchable_resource_events_topic": { - "title": "Searchable Resource Events Topic", - "description": "Name of the event topic used to track searchable resource deletion and upsertion events", + "resource_change_event_topic": { + "title": "Resource Change Event Topic", + "description": "Name of the event topic used to track resource deletion and upsertion events", "example": "searchable_resource", "env_names": [ - "mass_searchable_resource_events_topic" + "mass_resource_change_event_topic" ], "type": "string" }, @@ -228,7 +228,7 @@ }, "required": [ "searchable_classes", - "searchable_resource_events_topic", + "resource_change_event_topic", "resource_deletion_event_type", "resource_upsertion_event_type", "service_instance_id", diff --git a/example_config.yaml b/example_config.yaml index e3d5af6..8202412 100644 --- a/example_config.yaml +++ b/example_config.yaml @@ -13,6 +13,7 @@ kafka_servers: log_level: info openapi_url: /openapi.json port: 8080 +resource_change_event_topic: searchable_resource_events resource_deletion_event_type: searchable_resource_deleted resource_upsertion_event_type: searchable_resource_upserted searchable_classes: @@ -25,7 +26,6 @@ searchable_classes: name: Study Type - key: study.project.alias name: Project Alias -searchable_resource_events_topic: searchable_resource_events service_instance_id: '1' service_name: mass workers: 1 diff --git a/mass/adapters/inbound/event_sub.py b/mass/adapters/inbound/event_sub.py index 0e0a921..02406ee 100644 --- a/mass/adapters/inbound/event_sub.py +++ b/mass/adapters/inbound/event_sub.py @@ -48,10 +48,10 @@ class EventSubTranslatorConfig(BaseSettings): """Config for the event subscriber""" - searchable_resource_events_topic: str = Field( + resource_change_event_topic: str = Field( ..., description=( - "Name of the event topic used to track searchable resource deletion " + "Name of the event topic used to track resource deletion " + "and upsertion events" ), example="searchable_resource", @@ -74,7 +74,7 @@ class EventSubTranslator(EventSubscriberProtocol): def __init__( self, *, config: EventSubTranslatorConfig, query_handler: QueryHandlerPort ): - self.topics_of_interest = [config.searchable_resource_events_topic] + self.topics_of_interest = [config.resource_change_event_topic] self.types_of_interest = [ config.resource_deletion_event_type, config.resource_upsertion_event_type, diff --git a/tests/fixtures/test_config.yaml b/tests/fixtures/test_config.yaml index 9947916..fa169e8 100644 --- a/tests/fixtures/test_config.yaml +++ b/tests/fixtures/test_config.yaml @@ -26,7 +26,7 @@ searchable_classes: name: Field 1 - key: "has_object.type" name: Object Type -searchable_resource_events_topic: searchable_resource_events +resource_change_event_topic: searchable_resource_events resource_deletion_event_type: searchable_resource_deleted resource_upsertion_event_type: searchable_resource_upserted service_instance_id: 001 diff --git a/tests/test_consumer.py b/tests/test_consumer.py index 3a1c400..f48d204 100644 --- a/tests/test_consumer.py +++ b/tests/test_consumer.py @@ -67,7 +67,7 @@ async def test_resource_upsert( await joint_fixture.kafka.publish_event( payload=payload, type_=joint_fixture.config.resource_upsertion_event_type, - topic=joint_fixture.config.searchable_resource_events_topic, + topic=joint_fixture.config.resource_change_event_topic, key=f"dataset_embedded_{resource_id}", ) @@ -109,7 +109,7 @@ async def test_resource_delete(joint_fixture: JointFixture): await joint_fixture.kafka.publish_event( payload=resource_info.dict(), type_=joint_fixture.config.resource_deletion_event_type, - topic=joint_fixture.config.searchable_resource_events_topic, + topic=joint_fixture.config.resource_change_event_topic, key=f"dataset_embedded_{resource_info.accession}", ) diff --git a/tests/test_logging.py b/tests/test_logging.py index bc74f31..7512652 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -132,7 +132,7 @@ async def test_event_sub_logging( await joint_fixture.kafka.publish_event( payload=resource.dict(), type_=event_to_use, - topic=joint_fixture.config.searchable_resource_events_topic, + topic=joint_fixture.config.resource_change_event_topic, key=f"dataset_embedded_{resource.accession}", )