Skip to content

Commit

Permalink
Change kafka topic config name and update config
Browse files Browse the repository at this point in the history
  • Loading branch information
TheByronHimes committed Jul 28, 2023
1 parent 9658082 commit baf1354
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/.dev_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 5 additions & 5 deletions config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion example_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
6 changes: 3 additions & 3 deletions mass/adapters/inbound/event_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/test_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
)

Expand Down Expand Up @@ -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}",
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
)

Expand Down

0 comments on commit baf1354

Please sign in to comment.