Start begins processing outbox entries in the background. The processor will poll for pending entries at the configured interval. Parameters: - ctx context.Context: The context for the operation. When cancelled, processing stops.
(ctx context.Context)
| 99 | // Parameters: |
| 100 | // - ctx context.Context: The context for the operation. When cancelled, processing stops. |
| 101 | func (p *LineageOutboxProcessor) Start(ctx context.Context) { |
| 102 | p.mu.Lock() |
| 103 | if p.running { |
| 104 | p.mu.Unlock() |
| 105 | return |
| 106 | } |
| 107 | p.running = true |
| 108 | p.stopCh = make(chan struct{}) |
| 109 | p.mu.Unlock() |
| 110 | |
| 111 | p.wg.Add(1) |
| 112 | go func() { |
| 113 | defer p.wg.Done() |
| 114 | p.run(ctx) |
| 115 | }() |
| 116 | } |
| 117 | |
| 118 | // Stop gracefully stops the outbox processor. |
| 119 | // It signals the processor to stop and waits for pending work to complete. |