Commit 8ee11cf
committed
Refactor Dispatcher for modularity and maintainability
Refactored the `Dispatcher` class to improve readability, modularity, and maintainability:
- Renamed `_pChannelSize` to `_publishChannelSize` for clarity.
- Moved channel initialization to `InitializePublishedChannel` and `InitializeReceivedChannel`.
- Added `ResetStateIfNeeded` to handle state resets on disposal or cancellation.
- Extracted task startup logic into `StartSendingTaskAsync`, `StartProcessingTasksAsync`, and `StartSchedulerTaskAsync`.
- Improved scheduler handling with `RegisterSchedulerCancellationHandler` and `ProcessScheduledMessagesAsync`.
- Refactored message sending and processing into reusable methods like `SendBatchParallelAsync`, `SendBatchSequentialAsync`, and `ProcessReceivedMessageAsync`.
- Introduced helper methods for common logic, reducing redundancy.
- Enhanced exception handling for consistent logging and robustness.
- Organized code into regions for better structure and maintainability.1 parent 0ba5c7e commit 8ee11cf
1 file changed
+295
-166
lines changed
0 commit comments