Skip to content

Conversation

@hbrace
Copy link

@hbrace hbrace commented Dec 8, 2025

What

When a version is put to published, a message needs to go on the search-content-updated kafka topic so that the search service can make the dataset available to be searched for.
Jira - https://officefornationalstatistics.atlassian.net/browse/DIS-3448?atlOrigin=eyJpIjoiYjExYTg5MjI2MmY2NDQ4MGJmY2MzODk2OGY4N2QwZDUiLCJwIjoiaiJ9

How to review

With the dataset-catalogue compose stack running, have a dataset with the state approved.
Use the put state endpoint to change this to published with:

http://localhost:22000/datasets/<your-dataset>/editions/<your-edition>/versions/<version>/state

and a body of

{
  "state": "published"
}

Check the kafka topic with (this way worked for me, I'm not sure if theres an easier way), executing into one of the kafka containers with
docker exec -it int-dataset-catalogue-kafka-3-1 /bin/bash
Then check the kafka topic with:

cd /bin
./kafka-console-consumer --bootstrap-server localhost:9094 --topic search-content-updated

Check that the json message is put on the topic with the expected details.

Who can review

Anyone

@hbrace hbrace requested a review from a team as a code owner December 8, 2025 14:47
api/versions.go Outdated
searchContentUpdatedEvent := map[string]interface{}{
"dataset_id": updatedVersion.DatasetID,
"uri": updatedVersion.Links.Version.HRef,
"title": updatedVersion.Edition,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be updatedVersion.EditionTitle

"uri": updatedVersion.Links.Version.HRef,
"title": updatedVersion.Edition,
"content_type": updatedVersion.Type,
}
Copy link
Contributor

@andre-urbani andre-urbani Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if making the above change I think the edition id still needs to be included based on the swagger spec, so you'd probably need

"edition": updatedVersion.Edition

added to the object as well

api/versions.go Outdated
} else {
go func() {
api.searchContentUpdatedProducer.Producer.Output() <- kafka.BytesMessage{Value: jsonBytes, Context: ctx}
log.Info(ctx, "putState endpoint: sent search content update to kafka", logData)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at this point it's only been queued to the channel, not actually sent. So it might be worth changing it to something like -

putState endpoint: queued search content update for kafka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants