identify.js
function resolveAndSetEventIdAndSeqNos(record, userRecord, state, context) {
  // Get the resolveEventIdAndSeqNos function to use
  const resolveEventIdAndSeqNos = settings.getResolveEventIdAndSeqNosFunction(context);

  if (!resolveEventIdAndSeqNos) {
    const errMsg = `FATAL - Cannot resolve event id & sequence numbers, since no 'resolveEventIdAndSeqNos' function is configured. Configure one & redeploy ASAP!`;
    context.error(errMsg);
    throw new FatalError(errMsg);
  }

  try {
    // Resolve the event id & sequence number(s)
    const eventIdAndSeqNos = resolveEventIdAndSeqNos(record, userRecord) || {};

    // Set the event id & sequence number(s) on the given message's state or unusable record's state
    setEventIdAndSeqNos(state, eventIdAndSeqNos);

    return eventIdAndSeqNos;

  } finally {
    // Cache a description of the record for logging purposes
    resolveAndSetRecordDesc(state);
  }
}
function resolveAndSetEventIdAndSeqNos(record, userRecord, state, context) {
  // Get the resolveEventIdAndSeqNos function to use
  const resolveEventIdAndSeqNos = settings.getResolveEventIdAndSeqNosFunction(context);

  if (!resolveEventIdAndSeqNos) {
    const errMsg = `FATAL - Cannot resolve event id & sequence numbers, since no 'resolveEventIdAndSeqNos' function is configured. Configure one & redeploy ASAP!`;
    context.error(errMsg);
    throw new FatalError(errMsg);
  }

  try {
    // Resolve the event id & sequence number(s)
    const eventIdAndSeqNos = resolveEventIdAndSeqNos(record, userRecord) || {};

    // Set the event id & sequence number(s) on the given message's state or unusable record's state
    setEventIdAndSeqNos(state, eventIdAndSeqNos);

    return eventIdAndSeqNos;

  } finally {
    // Cache a description of the record for logging purposes
    resolveAndSetRecordDesc(state);
  }
}
function resolveAndSetEventIdAndSeqNos ( record , userRecord , state , context ) { // Get the resolveEventIdAndSeqNos function to use const resolveEventIdAndSeqNos = settings . getResolveEventIdAndSeqNosFunction ( context ) ; if ( ! resolveEventIdAndSeqNos ) { const errMsg = ` ` ; context . error ( errMsg ) ; throw new FatalError ( errMsg ) ; } try { // Resolve the event id & sequence number(s) const eventIdAndSeqNos = resolveEventIdAndSeqNos ( record , userRecord ) || { } ; // Set the event id & sequence number(s) on the given message's state or unusable record's state setEventIdAndSeqNos ( state , eventIdAndSeqNos ) ; return eventIdAndSeqNos ; } finally { // Cache a description of the record for logging purposes resolveAndSetRecordDesc ( state ) ; } }
Resolves the eventID, eventSeqNo and optional eventSubSeqNo for the given record & optional user record using the
configured `resolveEventIdAndSeqNos` function and then updates the given message or unusable record state with the
resolved values.
@param {Record} record - the record from which to resolve its eventID and eventSeqNo
@param {UserRecord|undefined} [userRecord] - the optional user record (if applicable) from which to resolve its eventSubSeqNo
@param {MessageState|UnusableRecordState} state - the message's or unusable record's tracked state to update with the resolved event id and sequence numbers
@param {StreamConsumerContext} context - the context to use
@param {ResolveEventIdAndSeqNos} [context.streamProcessing.resolveEventIdAndSeqNos]
@return {EventIdAndSeqNos} the resolved event id & sequence number(s)
Resolves the eventID eventSeqNo and optional eventSubSeqNo for the given record & optional user record using the configured resolveEventIdAndSeqNos function and then updates the given message or unusable record state with the resolved values .