Skip to content

How your application consumes a received message

All job responses are delivered through Cloud Pub/Sub subscriptions or customer-owned Pub/Sub topics to your application as described in Push, Pull, and Customer Topic delivery and Customer-Owned Google Cloud Resources.

Whether receiving messages via Modigie-managed subscriptions or directly from subscriptions created in your own GCP project on a customer-owned response topic, the message structure, attributes, discard handling, and payload semantics remain identical.

Your application consumes these job response messages as described in the Job Reference.

Sequence diagram showing an application consuming and processing received job response messages from Cloud Pub/Sub

Your application consumes received job messages

The job response is described in the Job Reference and the full schema in JobV2.

Tip

Your consumer should be tolerant and expect that not all fields are always present or populated.

Request not discarded

Check whether the Pub/Sub message has an attribute modigieJobRequestDiscardReasonType. If it does, the job request was discarded and no new job created. There will be no further messages for your request. The reason for discarding the job request is identified in the attribute's value. Instead of a job resource, the message will contain a JobV2Reason object with more details.

To analyze the root cause:

  • MissingJobIdError: Your job request was not published with the Pub/Sub attribute modigieJobRequestId. You may retry the same request with the Pub/Sub attribute modigieJobRequestId set.
  • InvalidJobIdError: Your job request was published with the Pub/Sub attribute modigieJobRequestId, but the attribute did not have a valid string value. You may retry the same request with the Pub/Sub attribute modigieJobRequestId set to a valid string value as the pattern describes in Job identifiers.
  • DuplicateJobIdError: Your job request was published with the Pub/Sub attribute modigieJobRequestId, but the ID was already used for a previous job request with a different payload. You may retry the same request with the Pub/Sub attribute modigieJobRequestId set to a new job request ID. For more information see Job identifiers.
  • InvalidJobExpireAfterError: Your job request was published with the Pub/Sub attribute modigieJobExpireAfter that had an invalid format. For the valid format, please refer to Schema | Job expiration.
  • BadRequestError: Your job request failed the schema validation. Such job responses indicate a flaw in the logic that determines if prospects have the required fields available to run a job. You may retry only after fixing the data that violated the schema. Typically, the error's message property will contain more information. Since your original modigieJobRequestId was not used for a job, you can reuse it when retrying with the altered job request.

Further details are provided in the JobV2Reason object, see JobV2Reason.

Message attributes

All job response messages for processed jobs include the following standard Pub/Sub attributes:

  • modigieJobRequestId: The request ID from the original job request (corresponds to the job's id).
  • modigieJobType: The type of the job (e.g., verifyMobile, enrichMobile, verifyEmployment).
  • modigieJobStatus: The terminal lifecycle status of the job (completed, rejected, canceled, or failed).

When a job terminates in a non-completed state, the job response message also contains the corresponding terminal reason attribute:

  • modigieJobRejectReasonType: Populated when modigieJobStatus = "rejected" (e.g., JobRejectReason, JobPersonInvalidNameRejectReason).
  • modigieJobCancelReasonType: Populated when modigieJobStatus = "canceled" (e.g., JobCancelByUserReason, JobExpireReason, JobPipelineEvictedReason).
  • modigieJobFailReasonType: Populated when modigieJobStatus = "failed" (e.g., JobFailReason, JobDeadlineExceededReason).

When a job request is discarded before a job resource is created, the response message contains:

  • modigieJobRequestId: The request ID from the original job request (if present).
  • modigieJobType: The type of the job.
  • modigieJobRequestDiscardReasonType: The error type describing why the request was discarded (e.g., DuplicateJobIdError, MissingJobIdError, BadRequestError).
  • modigiePubsubMessageId: The message ID of the job request message your application published.
  • modigiePubsubMessagePublishTime: The time when your application published the job request message that got discarded.

Note

If your application publishes two distinct job request messages with the same modigieJobRequestId value and an identical payload, the system will not create a new job resource, and the duplicate request has no effect on the existing job. However, if the job has already terminated, your application will receive the final job response message again. This allows you to replay final job response messages.

If a job request was not discarded and a job resource was created:

  • The job's id property will reflect the value that your application set as the attribute modigieJobRequestId in the original job request message.
  • The job's repository property references the exclusive Pub/Sub repository of your application and your Modigie Org Account.

Job status

Warning

Your application MUST digest the payload into the destination database only for a job that shows status = "completed"!

Check the job's status property to determine whether the job has already terminated.

The current status of the job represents its position in its life cycle. Note that your application should only digest information from a job into your database if the job's status = "completed". For more details, see Job states.

Note

Modigie charges only for jobs that reach the status completed!

Job reason in job's reason

If the job's status is terminal but not "completed", the job's reason property provides additional hints about why the job was not completed successfully. For more details, see Job failure reasons.