Audience Service

The in-app audience service is responsible for the lifecycle of the audiences within in-app. It will initialize an audience from a segment and also make sure that it’s being updated from that segment using the segment-diff service.

Service Overview

Audience Service Overview

Modules

The source for modules described here is available in the jobs folder for the workers and the scripts folder for the cron-jobs.

init-audience worker

Consumes messages from the inapp-init-audience queue and processes them by pulling the full segment associated with the audience and then in turn creates messages containing contact-ids into the inapp-batch queue.

update-audience worker

Consumes messages from the inapp-update-audience queue and using the segment-diff service looks for updates to the segment. For these updates it will create messages containing the contact-ids into the inapp-batch queue or inapp-remove queue depending on if contacts were added or removed.

queue-init-audience-jobs

Triggered every 5 minutes this will query the audience table for new audiences that have not yet been initialised and create a message and it into the inapp-init-audience queue.

queue-update-audience-jobs

Triggered every 5 minutes this will query the audience table for audiences that need to be updated from their corresponding segment and put a message for each such audience into the inapp-update-audience queue.