[claude] Claude adding fetch latest#52
Open
p14n wants to merge 1 commit intoaugment-catchup-latestfrom
Open
Conversation
Contributor
Reviewer's GuideThis PR introduces a fetchLatest feature that compares the current high‐water mark against the latest server message ID, fetches and persists one new event if available, extends the catchup server and gRPC layers to expose latest‐ID lookup, adds a system event path to trigger fetchLatest, and includes unit tests covering both new‐message and no‐newer‐message scenarios. Sequence diagram for fetchLatest event processingsequenceDiagram
participant SystemEventBroker
participant CatchupService
participant CatchupServer
participant Database
SystemEventBroker->>CatchupService: Publish SystemEvent.FetchLatest
CatchupService->>CatchupServer: getLatestMessageId(topic)
CatchupServer->>Database: SELECT MAX(idn) FROM postevent.{topic}
Database-->>CatchupServer: latestId
CatchupServer-->>CatchupService: latestId
CatchupService->>CatchupServer: fetchEvents(latestId-1, latestId, 1, topic)
CatchupServer-->>CatchupService: List<Event>
CatchupService->>Database: writeEventsToMessagesTable(events)
CatchupService->>SystemEventBroker: Publish SystemEvent.CatchupRequired (if event processed)
CatchupService-->>SystemEventBroker: Return processedCount
Class diagram for CatchupServerInterface and implementations with fetchLatest supportclassDiagram
class CatchupServerInterface {
+List<Event> fetchEvents(long, long, int, String)
+long getLatestMessageId(String)
}
class CatchupServer {
+List<Event> fetchEvents(...)
+long getLatestMessageId(String)
}
class CatchupGrpcClient {
+List<Event> fetchEvents(...)
+long getLatestMessageId(String)
}
class CatchupGrpcServer {
+void getLatestMessageId(GetLatestMessageIdRequest, StreamObserver)
}
CatchupServerInterface <|.. CatchupServer
CatchupServerInterface <|.. CatchupGrpcClient
CatchupGrpcServer --> CatchupServer : uses
class CatchupService {
+int fetchLatest(String)
+void onMessage(SystemEvent)
}
class SystemEventBroker {
+void triggerFetchLatest(String)
}
class SystemEvent {
CatchupRequired
UnprocessedCheckRequired
FetchLatest
String topic
}
Class diagram for SystemEvent and SystemEventBroker changesclassDiagram
class SystemEvent {
<<enum>>
CatchupRequired
UnprocessedCheckRequired
FetchLatest
String topic
}
class SystemEventBroker {
+void triggerFetchLatest(String)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Add support for fetching and processing the single latest message in CatchupService, wired through a new SystemEvent.FetchLatest, backed by server- and gRPC-side getLatestMessageId, with accompanying tests and build publishing setup
New Features:
Build:
Tests: