...
- Deprecate (and later remove) the internal system property REMOVE_FROM_QUEUE_ON_EXCEPTION, but detect if it is set to false and support existing behavior (infinite retries)
- Create a new callback API that will be executed when an exception is returned with the acknowledgement from the receiver
- Provide an example implementation of the callback that saves events with exceptions returned from the receiver in a 'dead-letter' queue on the sender (on disk)
- Add a new property for the gateway sender to specify the path to the custom implementation of the callback.
- If no path is provided, use default, example implementation
- if property is not specified, revert to existing behavior (removing events from the queue when ack is received, ignoring batch exceptions)
- Add 2 new properties for the gateway receiver to control when to send the acknowledgement with the exceptions:
- the number of retries for events failing with an exception
- the wait time between retries
...
- 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 |