Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Ability to modify batch removal to remove specific events from the batch
  • Ability to resend events saved in dead-letter queue

Current Implementation

PlantUML
entity EventProcessor as A
entity RemoteDispatcher as B
entity ServerConnection as C
entity ReceiverCommand as D
box "Site 1" #LightBlue
  participant A
  participant B
endbox
box "Site 2" #LightBlue
  participant C
  participant D
endbox
A -> A: peekBatchFromQueue
A -> B: dispatchBatch
B -> B: getConnection
B -> C: sendBatch
C -> C: readRequest
C -> C: createCommand
C -> D: execute
D -> D: readBatchEvents
loop For Each Batch Event
  loop Retry
    D -> D: determineOperation (create, update, destroy)
    D -> D: executeOperation
    alt Successful executeOperation:
      D -> D: breakRetry
    else Failed executeOperation:
      alt Remove from queue on exception:
        D -> D: storeException
        D -> D: breakRetry
      else Keep in queue on exception:
        D -> D: sleep N milliseconds
        D -> D: continueRetry
      end
    end
  end
end
D -> B: sendAcknowledgement
B -> B: readAcknowledgement
B -> B: logExceptions (if necessary)
A -> A: removeBatchFromQueue

Proposed Implementation

PlantUML
entity EventProcessor as A
entity RemoteDispatcher as B
entity ServerConnection as C
entity ReceiverCommand as D
entity FailedEventHandler as E
box "Site 1" #LightBlue
  participant A
  participant B
  participant E
endbox
box "Site 2" #LightBlue
  participant C
  participant D
endbox
A -> A: peekBatchFromQueue
A -> B: dispatchBatch
B -> B: getConnection
B -> C: sendBatch
C -> C: readRequest
C -> C: createCommand
C -> D: execute
D -> D: readBatchEvents
loop For Each Batch Event
  loop Retry numberOfRetries
    D -> D: determineOperation (create, update, destroy)
    D -> D: executeOperation
    alt Successful executeOperation:
      D -> D: breakRetry
    else Failed executeOperation:
      D -> D: storeException
      D -> D: sleep waitTimeBetweenRetries milliseconds

      D -> D: continueRetry
    end
  end
end
D -> B: sendAcknowledgement
B -> B: readAcknowledgement
loop For Each Failed Batch Event
  B -> E: onException
end
A -> A: removeBatchFromQueue