Processes

The client-service consists of a few processes the main one being the Web process which serves the main API.

Web

Fastify web-server which provides the main REST API for the client-service.

Output

As a response to the requests received via the REST API the web server produces a few different outputs in form of messages.

Client App-code Mismatch Requests

Produced by the validate-app-code hook when a mismatch is detected between the app-code in the request param and the app-code stored in the client-state token. Publishes a message to client-app-code-mismatch-requests PubSub topic.

Client State Client Updates

When any direct property of a client is changed a message is published to the client-state-client-updates

Client State Push Token Updates

When the push-token of a client is changed a message is published to the client-state-push-token-updates

Client State Contact Updates

Client Changes

Any change to a client (properties, push-token, contact-field) is published to the client-changes topic.

Web-Safari

Workers / Change Client App Code

This worker consumes messages from the me-client-change-client-app-code subscription which in turn is bound to the client-app-code-mismatch-requests topic.

The whole point of the worker is react to requests where the app-code does not match the one stored in the client-state. This happens when a customer uses multiple app-codes within the same app to e.g. cope with multiple countries.

This needs to be handled to avoid bad state of the client data both in big-query client state and dynamo device storage.

Actions

  1. Reset push-token and client using old app-code both in big-query client state and dynamo device storage.

  2. Set push-token of client using new app-code in both big-query client state and dynamo device storage.

  3. Reset contact for client using old app-code both in big-query client state and dynamo device storage.

  4. Set contact for client using new app-code by publishing a login-message.

Workers / Identified Contact Resolver

Subscriber of the contact-changes topic with a filter=contact-field and is_anonymous set to false. Uses the contact-data service to resolve contact-id from the contact-field.

Output

On success a message (type=contact-id) is published to the client-changes topic.

Workers / Anonymous Contact Resolver

Subscriber of the contact-changes topic with a filter=contact-field and is_anonymous set to true. Uses the contact-data service to resolve contact-id from the contact-field and if needed will create a new anonymous contact.

Output

On success a message (type=contact-id) is published to the client-changes topic.

Workers / Contact Id Writer

Subscriber of the contact-changes topic with type=contact-id.

  • Update the contact-id fields of the device in dynamo

  • Update the contact-field of the contact-reference

  • Publish an update to the client-state-contact-updates topic.

Workers / Suite Contact Updater

Subscriber of the contact-changes topic where should_update_suite_contact_fields=true. Will publish an event to the me-publisher-sdk AMQP-queue to make sure the suite-contact is updated for older customers.