Events
Este documento detalla los mecanismos de mensajería utilizados en el microservicio de Gestión de Reabastecimiento, específicamente el uso de Amazon Simple Notification Service (SNS) para la comunicación asíncrona entre servicios.
Eventos Restocking Created
Section titled “Eventos Restocking Created”Nombre: restocking-manager-alert-created-topic.fifo
Propósito: Notificar a otros servicios cuando se crea un reabastecimiento.
ARN en Producción:
arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-created-topic.fifoARN en Staging:
arn:aws:sns:us-east-2:529305108461:restocking-manager-alert-created-topic.fifoDeduplicación: Se utiliza el ID de restocking como ID de deduplicación:
const deduplicationId = 'created-' + restocking.id.valueAgrupación de mensajes: Los mensajes se agrupan por EAN del producto para garantizar el orden dentro de cada grupo:
const groupId = restocking.product.ean.valueFormato del mensaje:
export interface RestockingCreatedMessage { type: 'RestockingCreated' data: { restockingId: string productEan: string productSku: string productName: string | null type: RestockingType level: RestockingLevel status: RestockingStatus } context: { country: string warehouse: string }}Eventos Restocking Updated
Section titled “Eventos Restocking Updated”Nombre: restocking-manager-alert-updated-topic.fifo
Propósito: Notificar a otros servicios cuando se actualiza un reabastecimiento.
ARN en Producción:
arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-updated-topic.fifoARN en Staging:
arn:aws:sns:us-east-2:529305108461:restocking-manager-alert-updated-topic.fifoDeduplicación: Se utiliza el ID de restocking como ID de deduplicación:
const deduplicationId = 'updated-' + restocking.id.valueAgrupación de mensajes: Los mensajes se agrupan por EAN del producto para garantizar el orden dentro de cada grupo:
const groupId = restocking.product.ean.valueFormato del mensaje:
export interface RestockingUpdatedMessage { type: 'RestockingUpdated' data: { restockingId: string productEan: string productSku: string productName: string | null type: RestockingType level: RestockingLevel status: RestockingStatus } context: { country: string warehouse: string }}Eventos Restocking Completed
Section titled “Eventos Restocking Completed”Nombre: restocking-manager-alert-completed-topic.fifo
Propósito: Notificar a otros servicios cuando se completa un reabastecimiento.
ARN en Producción:
arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-completed-topic.fifoARN en Staging:
arn:aws:sns:us-east-2:529305108461:restocking-manager-alert-completed-topic.fifoDeduplicación: Se utiliza el ID de restocking como ID de deduplicación:
const deduplicationId = 'completed-' + restocking.id.valueAgrupación de mensajes: Los mensajes se agrupan por EAN del producto para garantizar el orden dentro de cada grupo:
const groupId = restocking.product.ean.valueFormato del mensaje:
export interface RestockingCompletedMessage { type: 'RestockingCompleted' data: { restockingId: string productEan: string productSku: string productName: string | null type: RestockingType level: RestockingLevel status: RestockingStatus } context: { country: string warehouse: string }}Eventos Restocking Restock
Section titled “Eventos Restocking Restock”Nombre: restocking-manager-alert-restock-topic
Propósito: Notificar a otros servicios cuando sé registrar un restock en un reabastecimiento.
ARN en Producción:
arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-restock-topicARN en Staging:
arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-restock-topicFormato del mensaje:
export interface RestockingRestockMessage { type: 'RestockingRestock' data: { restockingId: string productEan: string productSku: string productName: string | null type: RestockingType level: RestockingLevel status: RestockingStatus entryId: string transactionId: string quantity: number restockedAt: string } context: { country: string warehouse: string }}Eventos Restock Registered
Section titled “Eventos Restock Registered”Nombre: restocking-manager-restock-registered-topic
Propósito: Notificar a otros servicios cuando se registra un restock.
ARN en Producción:
arn:aws:sns:us-east-1:849786826922:restocking-manager-restock-registered-topicARN en Staging:
arn:aws:sns:us-east-2:529305108461:restocking-manager-restock-registered-topicFormato del mensaje:
export interface RestockRegisteredMessage { type: 'RestockRegistered' data: { id: string ean: string target: string source: string quantity: number user: string timestamp: string alertId?: string level?: string zone?: string } context: { country: string warehouse: string }}