---
id: ProcessVectorBatchIntegrationEvent
name: Process vector batch
version: 1.0.0
summary: |
  Integration event published by Scheduler every five minutes to trigger
  Catalog Ingestion vector batch processing over Kafka.
owners:
  - platform-engineering-team
badges:
  - content: Integration Event
    backgroundColor: orange
    textColor: orange
    icon: BoltIcon
schemaPath: schema.json
---

`ProcessVectorBatchIntegrationEvent` (v1.0.0) is a lightweight scheduled trigger published every five minutes by [[service|scheduler-service]] over Kafka. [[service|catalog-ingestion]] consumes this event to fetch changed catalog records from PostgreSQL, generate embeddings, and update the Qdrant vector index.

## Overview

| Property                             | Value                                                                           |
| :----------------------------------- | :------------------------------------------------------------------------------ |
| **Bounded Context**                  | Platform / Scheduler                                                            |
| **Producer**                         | [[service\|scheduler-service]]                                                  |
| **Consumer(s)**                      | [[service\|catalog-ingestion]] (consumer group `catalog-ingestion`)             |
| **Protocol / Format**                | Kafka + CloudEvents JSON (camelCase payload)                                    |
| **Channel / Topic**                  | [[channel\|scheduler.process-vector-batch]] (unprefixed across environments)    |
| **Dead-Letter Channel**              | None (pending records remain queued in PostgreSQL for the next scheduled batch) |
| **Partition Key**                    | None (single trigger event per 5-minute cron `0 0/5 * * * ?` UTC)               |
| **Delivery / Idempotency Guarantee** | Published via transactional outbox; misfire policy `FireOnceNow`                |

:::note
Unlike every other BookWorm integration topic, `scheduler.process-vector-batch` is **unprefixed** (omits `bookworm.{env}.`) so the static Azure Functions Kafka trigger binding matches across environments.
:::

## Payload Fields & Envelope

### Event Payload

The event carries only the two base envelope fields; batch sizing, selection order, and vector upsert logic remain owned by [[service|catalog-ingestion]].

| Name           | Type                   | Required | Constraints            | Description                                      |
| :------------- | :--------------------- | :------- | :--------------------- | :----------------------------------------------- |
| `id`           | `string` (`uuid`)      | Yes      | UUIDv7                 | Unique identifier of the trigger event           |
| `creationDate` | `string` (`date-time`) | Yes      | ISO 8601 UTC timestamp | UTC timestamp when the trigger event was created |

### CloudEvents Envelope Headers

| Header        | Value / Source                                          | Purpose                                                     |
| :------------ | :------------------------------------------------------ | :---------------------------------------------------------- |
| `messagetype` | `BookWorm.Contracts.ProcessVectorBatchIntegrationEvent` | Explicit message identity for cross-service deserialization |
| `source`      | `urn:bookworm:bookworm-scheduler`                       | Identifies the producing service                            |

## Delivery Guarantees & Error Handling

| Condition                            | System Behavior                                  | Recovery / Compensation                                     |
| :----------------------------------- | :----------------------------------------------- | :---------------------------------------------------------- |
| Misfire during Scheduler downtime    | Scheduler applies `FireOnceNow` misfire handling | A single catch-up event is published when Scheduler resumes |
| Catalog Ingestion processing failure | Azure Functions Kafka trigger invocation fails   | Pending records remain eligible on the next five-minute run |

## Related Documentation

- [[channel|scheduler.process-vector-batch]] — Unprefixed Kafka channel specification.
- [[service|scheduler-service]] — Quartz scheduler service.
- [[service|catalog-ingestion]] — Azure Functions consumer service.

<NodeGraph />

<SchemaViewer
	file="schema.json"
	title="Process vector batch schema"
	maxHeight="500"
	search="true"
/>


 ## Raw Schema:schema.json

{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"$id": "BookWorm.Contracts.ProcessVectorBatchIntegrationEvent",
	"title": "ProcessVectorBatchIntegrationEvent",
	"type": "object",
	"additionalProperties": false,
	"required": ["id", "creationDate"],
	"properties": {
		"id": {
			"type": "string",
			"format": "uuid",
			"description": "Unique identifier of the integration event."
		},
		"creationDate": {
			"type": "string",
			"format": "date-time",
			"description": "UTC timestamp when the event was created."
		}
	}
}
