-
Notifications
You must be signed in to change notification settings - Fork 7
Introducing the DcbEventChannel using the DCB API
#422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 31 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
8abe19e
[maven-release-plugin] prepare release axonserver-connector-java-2023…
m1l4n54v1c 9c3d167
[maven-release-plugin] prepare for next development iteration
m1l4n54v1c b3d0c11
[maven-release-plugin] rollback the release of axonserver-connector-j…
m1l4n54v1c 65a1665
Merge remote-tracking branch 'origin/master'
m1l4n54v1c 534a108
Added DcbEventChannel with methods for appending events and requestin…
m1l4n54v1c fc8c1c3
Adapted to the latest API changes.
m1l4n54v1c 7857fd1
Merge remote-tracking branch 'origin/master' into feature/dcb
m1l4n54v1c d76f015
Adapted to the latest API changes.
m1l4n54v1c 71f506e
Added head, tail, and tagsFor methods.
m1l4n54v1c 49321b1
Added stream test.
m1l4n54v1c 8057e15
Added a few more tests for the DCB.
m1l4n54v1c 06f123b
Added a few more tests for the DCB.
m1l4n54v1c f487f05
Added a few more tests for the DCB.
m1l4n54v1c 49f3231
- Removed unnecessary imports.
m1l4n54v1c 270a7a6
Merge remote-tracking branch 'origin/master' into feature/dcb
m1l4n54v1c 0546d69
- Added few more stream tests.
m1l4n54v1c ecb9ef7
Merge branch 'master' of github.com:AxonIQ/axonserver-connector-java …
silvanob c80a41b
Update API version to 2025.1.0-SNAPSHOT
smcvb 4d93e24
- Added support for creation of dcb contexts.
m1l4n54v1c ef58769
- Tests are now resilient to non-emptiness of the event store.
m1l4n54v1c 7452dbc
Add mechanism to get Axon Server image
smcvb 914c49e
Adjusted assert message.
m1l4n54v1c 703fbfc
- Adapted append test to check the response to append events accordin…
m1l4n54v1c a08bb0c
Merge remote-tracking branch 'origin/feature/dcb' into feature/dcb
m1l4n54v1c 63cf8e9
getSequenceAt impl
schananas 994df79
Add Axon Server image env variable
smcvb 73d654d
Add log statement to see it work
smcvb d0c7f01
Update src/main/java/io/axoniq/axonserver/connector/AxonServerConnect…
m1l4n54v1c eebfea6
Update src/main/java/io/axoniq/axonserver/connector/event/DcbEventCha…
m1l4n54v1c 449655a
Update src/main/java/io/axoniq/axonserver/connector/event/DcbEventCha…
m1l4n54v1c 3d08ed0
Update src/main/java/io/axoniq/axonserver/connector/event/impl/DcbEve…
m1l4n54v1c b698419
getSequenceAt issues
schananas 0a1f4ae
getSequenceAt integration tests
schananas ad0ddc2
Merge remote-tracking branch 'origin/feature/dcb' into feature/dcb
schananas c12a811
getSequenceAt integration tests
schananas 2b2dc21
getSequenceAt integration tests
schananas 782c57f
- Removed unnecessary println.
m1l4n54v1c b2163ad
- Removed unnecessary GetHeadRequest and GetTailParameters.
m1l4n54v1c c5c24c2
- Streamlined startTransaction API
m1l4n54v1c e3b1818
- Collect stream buffers on creation so they can be closed on reconne…
m1l4n54v1c 54190c5
- Changed the default values for buffer size and refill batch.
m1l4n54v1c c60aba8
- Changed the api of the stream method to allow customization of buff…
m1l4n54v1c 58e28dd
- Simplified tagsFor API.
m1l4n54v1c 4ea6e78
Update src/main/java/io/axoniq/axonserver/connector/event/DcbEventCha…
m1l4n54v1c File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
151 changes: 151 additions & 0 deletions
151
src/main/java/io/axoniq/axonserver/connector/event/DcbEventChannel.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| /* | ||
| * Copyright (c) 2020-2024. AxonIQ | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.axoniq.axonserver.connector.event; | ||
|
|
||
| import io.axoniq.axonserver.connector.ResultStream; | ||
| import io.axoniq.axonserver.grpc.event.dcb.AppendEventsResponse; | ||
| import io.axoniq.axonserver.grpc.event.dcb.ConsistencyCondition; | ||
| import io.axoniq.axonserver.grpc.event.dcb.GetHeadRequest; | ||
| import io.axoniq.axonserver.grpc.event.dcb.GetHeadResponse; | ||
| import io.axoniq.axonserver.grpc.event.dcb.GetSequenceAtRequest; | ||
| import io.axoniq.axonserver.grpc.event.dcb.GetSequenceAtResponse; | ||
| import io.axoniq.axonserver.grpc.event.dcb.GetTagsRequest; | ||
| import io.axoniq.axonserver.grpc.event.dcb.GetTagsResponse; | ||
| import io.axoniq.axonserver.grpc.event.dcb.GetTailRequest; | ||
| import io.axoniq.axonserver.grpc.event.dcb.GetTailResponse; | ||
| import io.axoniq.axonserver.grpc.event.dcb.SourceEventsRequest; | ||
| import io.axoniq.axonserver.grpc.event.dcb.SourceEventsResponse; | ||
| import io.axoniq.axonserver.grpc.event.dcb.StreamEventsRequest; | ||
| import io.axoniq.axonserver.grpc.event.dcb.StreamEventsResponse; | ||
| import io.axoniq.axonserver.grpc.event.dcb.TaggedEvent; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.concurrent.CompletableFuture; | ||
|
|
||
| /** | ||
| * Communication channel for Event related interaction with Axon Server based on the Dynamic Consistency Boundaries | ||
| * concept. | ||
| * | ||
| * @author Milan Savic | ||
| * @since 2025.1.0 | ||
| */ | ||
| public interface DcbEventChannel { | ||
|
|
||
| /** | ||
| * Starts a new transaction to append events. | ||
| * | ||
| * @return the transaction reference onto which to register events to append along with the condition | ||
| */ | ||
| AppendEventsTransaction startTransaction(); | ||
m1l4n54v1c marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Provides an infinite stream of events. | ||
| * | ||
| * @param request the request used to filter events | ||
| * @return an infinite stream of events | ||
| */ | ||
| ResultStream<StreamEventsResponse> stream(StreamEventsRequest request); | ||
|
|
||
| /** | ||
| * Provides a finite stream of events used to eventsource a model. | ||
| * | ||
| * @param request the query used to filter out events for sourcing | ||
| * @return the response containing events to source a model and a consistency marker to be used when trying to | ||
| * append new events to the event store | ||
| */ | ||
| ResultStream<SourceEventsResponse> source(SourceEventsRequest request); | ||
|
|
||
| /** | ||
| * Provides tags for an event at the given global sequence. | ||
| * | ||
| * @param request the sequence of an event | ||
| * @return the tags fo the event | ||
| */ | ||
| CompletableFuture<GetTagsResponse> tagsFor(GetTagsRequest request); | ||
|
|
||
| /** | ||
| * Provides the head of the event store. | ||
| * | ||
| * @param request empty request | ||
m1l4n54v1c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * @return the head of the event store | ||
| */ | ||
| CompletableFuture<GetHeadResponse> head(GetHeadRequest request); | ||
|
|
||
| /** | ||
| * Provides the tail of the event store. | ||
| * | ||
| * @param request empty request | ||
m1l4n54v1c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * @return the tail of the event store | ||
| */ | ||
| CompletableFuture<GetTailResponse> tail(GetTailRequest request); | ||
|
|
||
| /** | ||
| * Provides the sequence number of the event closest to the given timestamp. | ||
| * If the timestamp is before the first event, returns the tail sequence. | ||
| * If the timestamp is after the last event, returns the head sequence. | ||
| * | ||
| * @param request the request containing the timestamp to find the sequence for | ||
| * @return the sequence at the given timestamp | ||
| */ | ||
| CompletableFuture<GetSequenceAtResponse> getSequenceAt(GetSequenceAtRequest request); | ||
m1l4n54v1c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Provides operations to interact with a Transaction to append events and a condition onto the Event Store. | ||
| */ | ||
| interface AppendEventsTransaction { | ||
|
|
||
| /** | ||
| * Sets the Consistency Condition for the transaction. Axon Server will validate this condition against the | ||
| * Event Store and based on the validation outcome will accept or reject the transaction. | ||
| * | ||
| * @param condition the Consistency Condition used to validate the Transaction | ||
| * @return this Transaction for fluency | ||
| */ | ||
| AppendEventsTransaction condition(ConsistencyCondition condition); | ||
|
|
||
| /** | ||
| * Appends this {@code taggedEvent} to this transaction. | ||
| * | ||
| * @param taggedEvent the event to be appended | ||
| * @return this Transaction for fluency | ||
| */ | ||
| AppendEventsTransaction append(TaggedEvent taggedEvent); | ||
|
|
||
| /** | ||
| * Appends all events from the collection of {@code taggedEvents} to this transaction | ||
| * | ||
| * @param taggedEvents the collection of events to be appended | ||
| * @return this Transaction for fluency | ||
| */ | ||
| default AppendEventsTransaction appendAll(Collection<TaggedEvent> taggedEvents) { | ||
| taggedEvents.forEach(this::append); | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Commits this Transaction. | ||
| * | ||
| * @return the future that completes once the Axon Server commits this Transaction, containing the append events response as a result. | ||
| */ | ||
| CompletableFuture<AppendEventsResponse> commit(); | ||
|
|
||
| /** | ||
| * Rolls back the transaction. | ||
| */ | ||
| void rollback(); | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to make sure that we construct a pull request for this Axon Server API before we can go ahead with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would need to merge it even to have a snapshot right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, exactly!