-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat: Start projection from custom offset #934
Conversation
* support a way for the user to define the offset that is used when starting the Projection * optionally load the existing stored offset and pass that to the user function * some rather messy jugling of SourceProvider adapters
akka-projection-core/src/main/scala/akka/projection/scaladsl/SourceProvider.scala
Outdated
Show resolved
Hide resolved
...-eventsourced/src/main/scala/akka/projection/eventsourced/javadsl/EventSourcedProvider.scala
Outdated
Show resolved
Hide resolved
akka-projection-core/src/main/scala/akka/projection/scaladsl/SourceProvider.scala
Outdated
Show resolved
Hide resolved
akka-projection-core/src/main/scala/akka/projection/scaladsl/SourceProvider.scala
Outdated
Show resolved
Hide resolved
akka-projection-core/src/main/scala/akka/projection/scaladsl/SourceProvider.scala
Outdated
Show resolved
Hide resolved
I think I have a better idea for how to do this, closing until updated. |
*/ | ||
final class CustomStartOffsetSourceProvider[Offset, Envelope]( | ||
loadFromOffsetStore: Boolean, | ||
adjustStartOffset: Option[Offset] => Future[Option[Offset]], |
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.
The idea is that the user would decorate the ordinary SourceProvider by wrapping it with this
@InternalApi private[projection] object BySliceSourceProviderAdapter { | ||
def apply[Offset, Envelope]( | ||
sourceProvider: javadsl.SourceProvider[Offset, Envelope]): scaladsl.SourceProvider[Offset, Envelope] = | ||
sourceProvider match { |
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.
this javadsl -> scaladsl adapter is still rather messy, but need to unwrap the CustomStartOffsetSourceProvider decoration and implement it here instead to keep the BySlicesSourceProvider type
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.
Actually, it will be a problem also for the normal scaladsl case. I'll have to take another look at that.
This will not fly because of the optional traits that we look for: BySlicesSourceProvider, EventTimestampQuery, LoadEventQuery I'll open a new PR with a different approach. |
On top of #933