Package io.meeds.commons.digest.service


package io.meeds.commons.digest.service
  • Classes
    Class
    Description
    Answers "is this user due now?" in his own local calendar, in Java and not in SQL, so that the rule is the same on every database.
    Keeps NTF_DIGEST_USERS, the work list of the digest sender job, in sync with the choices of the users: the row holds only what the job needs to answer "which users are due now?".
    Finds the wording of a digest label in the language of the recipient.
    Builds one digest email from the waiting items of one occurrence: keeps the categories the user selected for this frequency (the second half of the double check), groups them in display order, asks each addon for its lines, caps every category and counts the rest, then lays everything out with the template.
    Puts a digest email in the platform mail queue, with the same row shape and the same checks as the legacy QueueMessage.put, but through the Spring EntityManager: called inside the transaction that claims the occurrence, the queue row and the watermark commit, or roll back, together.
    Renders the digest email template.
    One occurrence of one frequency for one user, as a single transaction: the claim of the occurrence (the guarded move of the watermark), the reading of the waiting items, the building of the email, its row in the mail queue and the deletion of the covered items commit together, or roll back together.
    Writes and reads back the PARAMS column of a waiting item: a small JSON object of strings, ids only.
    What the digest email needs to know about its recipient and about the platform, gathered from the existing notification helpers so that the digest emails come from the same sender and use the same links as the instant ones.
    The work list of the digest sender job: who is a candidate, the claim of an occurrence, the waiting items of a user and their deletion.
    One run of the digest sender job: the safety cleanup, then the selection of the users due now, then one task per due user serving his frequencies one after the other, on a small worker pool.
     
    Reads and writes the digest settings through SettingService, whose cache is in-memory and cluster-coherent: a change saved on one server applies immediately on every server.