Skip to main content
Version: 2.0.x

Upgrade to 2.0.0

Upgrade from 1.11.1 using your existing database. Tables, payloads, handler IDs and retry state stay in place; pending records can be processed after the upgrade.

1. Update dependencies​

Set io.namastack:namastack-outbox-bom to 2.0.0 and remove explicit 1.x versions from individual Namastack modules. JDBC and MongoDB starter names are unchanged. Replace these removed modules if you use them:

RemoveUse instead
namastack-outbox-starter-jpanamastack-outbox-starter-jdbc
namastack-outbox-jpanamastack-outbox-jdbc
namastack-outbox-metrics / namastack-outbox-tracingnamastack-outbox-observability

JPA applications: keep your business entities, Spring Data JPA and JpaTransactionManager. JDBC outbox persistence must use the same DataSource. Point JDBC at your existing physical table names if Hibernate used custom naming; see persistence configuration. Remove explicit references to the old Namastack JPA entities and dialect.

2. Update configuration​

Rename deprecated properties​

All paths below are relative to namastack.outbox. Skip these renames if you already use the replacement names.

Old propertyReplacement
poll-intervalpolling.fixed.interval
batch-sizepolling.batch-size
rebalance-intervalinstance.rebalance-interval
processing.publish-after-savemulticaster.publish-after-save
processing.shutdown-timeout-secondsprocessing.shutdown-timeout
instance.heartbeat-interval-secondsinstance.heartbeat-interval
instance.stale-instance-timeout-secondsinstance.stale-instance-timeout
instance.graceful-shutdown-timeout-secondsinstance.graceful-shutdown-timeout

Convert values from *-seconds to durations: 30 becomes 30s. Carry over the old property's effective value and update all configuration sources, including environment variables. Removed properties can be silently ignored.

Restore completed-record metrics​

In 2.0.0, namastack.outbox.observability.metrics.record-statuses defaults to [NEW, FAILED]. Completed-record counts are no longer enabled by default: the outbox.records gauge with outbox.record.status=completed is not registered. Dashboards and alerts that use this series will see a missing metric, not a zero count.

To keep collecting completed-record counts, explicitly include COMPLETED:

namastack:
outbox:
observability:
metrics:
record-statuses: [NEW, FAILED, COMPLETED]

Counting completed records adds database work that grows with retained history. If you do not need that count, keep the default and update affected dashboards and alerts. Update legacy meter names and tags using the current metric list.

Restore active observation timers with Spring Boot 4.2​

When upgrading Spring Boot from 4.1 to 4.2, observation-based *.active long-task timers are no longer created by default. This affects dashboards and alerts that measure in-progress outbox scheduling, delivery attempts or handler invocations. Timers for completed operations continue to be recorded.

If you use these active-operation metrics, enable them explicitly:

management:
metrics:
observations:
include-active-long-task-timer: true

Remove management.metrics.observations.ignored-meters if configured; Spring Boot 4.2 removes that property. The new setting applies to all observations handled by Boot's auto-configured DefaultMeterObservationHandler. See the Spring Boot migration notes.

3. Add the new database indexes​

MongoDB: no collection or index migration is required. Continue with Deploy and verify.

JDBC and JPA → JDBC: apply the SQL below for your database in a new Flyway migration or Liquibase changeset. Keep previously applied migrations and existing tables unchanged.

The table and column layout stays the same. The new indexes support the revised polling, record-loading and metrics queries. Existing records remain readable with the old indexes, but that does not establish their performance under your workload. Install the new indexes as part of the upgrade.

Add a new migration​

Choose the tab for your database and copy its SQL into the next unused migration version, for example V42__add_outbox_2_indexes.sql, or a new Liquibase SQL changeset. Keep the original table-creation migration unchanged. Apply the new migration before starting 2.0.0 workers.

These scripts assume the default outbox_record table and that the new index names do not exist yet. If schema initialization has already created an index, compare its definition with the SQL below and omit that creation statement when it matches. If an earlier attempt partially succeeded, reconcile those indexes before retrying.

For custom schemas, table prefixes or table names, use the existing physical table name throughout. Qualify names for the target schema; when several outboxes share a schema, also give each outbox's indexes distinct names.

Each tab links to the complete table and index definitions on main for reference.

Full PostgreSQL schema

CREATE INDEX idx_outbox_record_status_created_id
ON outbox_record (status, created_at, id)
INCLUDE (partition_no, next_retry_at, record_key);

CREATE INDEX idx_outbox_record_key_completed_created_id
ON outbox_record (record_key, completed_at, created_at, id);

CREATE INDEX idx_outbox_record_status_retry_partition
ON outbox_record (status, next_retry_at)
INCLUDE (partition_no);

CREATE INDEX idx_outbox_record_status_partition
ON outbox_record (status, partition_no);

For a maintenance window, run these statements through your migration tool with writers stopped. For an online build, use CREATE INDEX CONCURRENTLY for each statement and configure that migration to run outside a transaction. Inspect and resolve any invalid indexes left by an interrupted concurrent build before retrying; an existing name alone does not prove an index is usable.

Check the installed definitions:

SELECT indexname, indexdef
FROM pg_indexes
WHERE schemaname = current_schema()
AND tablename = 'outbox_record'
ORDER BY indexname;

These migrations add record indexes only. Keep the existing primary keys, instance indexes and partition-assignment indexes.

Keep schema creation separate from migration​

Configure the upgraded application to use your migration tool's schema:

namastack:
outbox:
jdbc:
schema-initialization:
enabled: false

On PostgreSQL, H2 and SQL Server, the initializer can add missing indexes to existing tables at startup. MySQL/MariaDB define indexes inside CREATE TABLE IF NOT EXISTS, and Oracle creates them inside the table-creation block, so running those creation scripts again does not add the new indexes to an existing table. Explicit migrations make the upgrade step visible and controllable on every database.

4. Deploy and verify​

Rehearse on a database copy. For a rollout with a maintenance window:

  1. Back up the database, pause producers and gracefully stop the old instances.
  2. Apply the index migration and start 2.0.0 against the same database.
  3. Confirm that existing pending records and due retries reach their handlers and downstream systems, then resume producers.
  4. Check that new business writes and outbox records commit or roll back together.

Keep payload classes, handler IDs, serializer and retention settings unchanged during this rollout. Keep processing-groups.enabled=false (the default) until every worker has upgraded; adopt named groups separately. For rolling upgrades and rollback requirements, follow Rolling Deployments. Retain the old indexes through the rollback window.

Remove obsolete indexes after the rollout​

Keep the old indexes while 1.x workers are active and during your rollback window. Once the rollout is verified, remove redundant old indexes in a separate migration to avoid their storage and write overhead. Confirm the actual names and definitions in your database first, especially if Hibernate or custom migrations created them.

Default 1.11.1 JDBC indexOracle equivalent
idx_outbox_record_record_key_createdidx_outbox_rec_key_cr
idx_outbox_record_partition_status_retryidx_outbox_rec_p_s_r
idx_outbox_record_status_retryidx_outbox_rec_s_r
idx_outbox_record_statusidx_outbox_rec_stat
idx_outbox_record_record_key_completed_createdidx_outbox_rec_k_c_c

The former JPA entity used idx_outbox_record_key_completed_created for the last index. Your database can therefore have a different name even with otherwise default configuration.

Drop only indexes that actually exist and have been superseded. The syntax is:

DatabaseDrop syntax (replace old_index_name)
PostgreSQL / H2 / OracleDROP INDEX old_index_name;
MySQL / MariaDB / SQL ServerDROP INDEX old_index_name ON outbox_record;

Do not drop your own application-specific indexes solely because they are absent from the new schema.

Other changes to check​

ChangeAction, if relevant
Scheduling now rejects calls without an active Spring transaction.No change for applications already scheduling transactionally.
Generated IDs and keys now use UUIDv7.Accept both UUIDv4 and UUIDv7; existing IDs and string columns stay unchanged.
Equal creation timestamps are ordered by record ID.Avoid relying on handler declaration order for timestamp ties.
Adaptive polling validates its intervals.Use min-interval >= 1ms and max-interval >= min-interval.
Completed-record counts are disabled by default.Opt in to COMPLETED or update affected dashboards and alerts; see record-status metrics.
State metrics are collected asynchronously.Treat NaN as unknown, not zero; see Observability.
Adaptive polling evaluates each record key query relative to the keys it could return, and keeps its interval while an instance owns no partitions.Review adaptive interval expectations; see Adaptive Polling.

Custom extensions and tests​

Only if you use repository APIs or construct Core objects directly

Rebuild these modules against 2.0.0 and update the affected APIs:

Old APIReplacement
OutboxRecordStatusRepositoryOutboxRecordRepository
save(record)create(record) for new records; duplicate IDs must fail.
update(record)updateProcessingState(record); update only processing fields and return false for missing rows.
findRecordKeysInPartitions(..., status, ...)Remove the status argument; the query selects due NEW records.
Java OutboxRecordMetadata constructorAdd trailing recordId and processingGroup arguments, e.g. null, "default" for scheduling fixtures.
Java OutboxFailureContext constructorAdd trailing processingGroup, e.g. "default".
OutboxPollingTrigger.onTaskComplete(recordCount)onPollResult(found, requested); requested is the most keys the query could return.

Custom repositories must also implement findIncompleteRecordPages, findOldestCreatedAtByPartitions and findOldestDueNextRetryAtByPartitions. Pages must include future NEW retries, preserve (createdAt, id) ordering, and include an empty page for requested keys with no records. The oldest-due query must match polling's eligibility rules. Follow the interface contracts when implementing these methods. Kotlin metadata constructors provide defaults for the added fields.

Direct Java construction of messaging handlers also needs the new Boolean settings; see messaging constructors.