Urgent.News

What's breaking now, across thousands of outlets.

Tech

Why the Outbox Pattern, Queue, and Embedding Worker?

The previous post covered why I chose pgvector for semantic search. But there was another question: When should a memory be embedded? At first, it might seem simple: Create memory ▼ Generate embedding ▼ Save embedding But this makes memory creation dependent on the embedding process. If the embedding provider is slow or unavailable, creating a memory could also fail or become slow. I wanted to…

The story explores the rationale behind using the Outbox Pattern, a Queue, and Embedding Worker in a system designed for semantic search. The author begins by explaining how the traditional approach of creating memory, generating an embedding, and then saving the embedding can lead to issues if the embedding provider is slow or unavailable.

To avoid this, they introduce the Outbox Pattern, which ensures that memory creation and embedding events occur together within a single database transaction. This way, if one fails, both fail, preventing data loss.

The next step is to separate the embedding process from the memory creation, using a Queue and an Embedding Worker. This allows for asynchronous processing, where the user can save a memory without waiting for the embedding provider. The Queue reads pending outbox events and puts jobs onto a queue for the Embedding Worker, which turns memory text into an embedding and stores it in pgvector.

This separation enables the embedding pipeline to be scaled independently and allows for retries and failure isolation without blocking the memory API.

The author emphasizes the benefits of this design, noting that it keeps embedding-specific logic out of the Memory Service's synchronous request path, making it easier to evolve the embedding pipeline later. For instance, changes to embedding models, chunking strategies, or retry behaviors can be made without affecting the API used to create a memory.

This design also introduces a small delay between memory creation and its availability for semantic search, accepting eventual consistency between the memory record and its vector representation.

In summary, the author presents a system where memory creation and embedding are decoupled through the Outbox Pattern, Queue, and Embedding Worker, providing resilience, scalability, and the ability to evolve the embedding process independently.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Wazuh FIM "not detecting" a changed file usually means it has not looked yet

You add a directory to Wazuh file integrity monitoring, change a file, and nothing happens. On Wazuh 4.14.7 the usual reason is the schedule, not a bug. We measured it on a manager container.

  • Wazuh FIM typically waits 12 hours for file change detection
  • Real-time monitoring enables immediate file change detection
  • Adjust agent.conf to enable realtime= yes for specific directories

Docker permission denied: why it happens and how to fix it properly

Docker permission denied: what the error is actually telling you A client messages me about this error almost every week. They run a command, see "permission denied", and assume Docker is broken.

  • "Docker permission denied" has two meanings: before container start and inside running container
  • Permission errors occur due to mismatch between process UID/GID and file/socket ownership
  • Fix errors by adjusting file permissions, ownership, or Docker daemon configuration

LopeBase: The Meta-Tool for Managing the Side Project Graveyard

LopeBase: The Meta-Tool for Managing the Side Project Graveyard Why It Matters Most developers experience a specific type of burnout known as "dashboard fatigue." You have a SaaS product, a personal…

  • LopeBase addresses dashboard fatigue for developers managing multiple projects.
  • It automates content creation by connecting projects through a shared admin layer.
  • Skepticism exists about the tool's promised automation scope and potential maintenance overhead.

More from Wednesday 7 October →