Skip to content
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

Typed persistent event adapters/wrappers #25050

Merged
merged 7 commits into from May 25, 2018

Conversation

chbatey
Copy link
Member

@chbatey chbatey commented May 4, 2018

Not ready for merge or code review.

Just wanted an opinion on a possible API that could replace the need for basic event adapters.

I called it wrapper for now as that is the current use case.

@chbatey
Copy link
Member Author

chbatey commented May 4, 2018

Snapshot tests will fail as i made it use leveldb, before the tests relied on the sync nature of the inmemory snapshoter

@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed validating PR is currently being validated by Jenkins labels May 4, 2018
@akka-ci
Copy link

akka-ci commented May 4, 2018

Test FAILed.

Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a good approach

replyProbe.expectMessage(State(1, Vector(0)))

val events = queries.currentEventsByPersistenceId(pid).runWith(Sink.seq).futureValue
events shouldEqual List(EventEnvelope(Sequence(1), pid, 1, Wrapper(Incremented(1))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if one would like the unwrapped here it could be possible to use the same adapter in a map?

*/
def withTagger(tagger: Event ⇒ Set[String]): PersistentBehavior[Command, Event, State] =
copy(tagger = tagger)
eventWrapper(new TaggingEventWrapper[Event](tagger))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The we would have to support more than one EventWrapper and then the types would go haywire?
Perhaps keep tags separate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that journals don't return the Tagged back it doesn't fit with the Wrapper anyhow

@akka-ci akka-ci added validating PR is currently being validated by Jenkins and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) labels May 8, 2018
@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed validating PR is currently being validated by Jenkins labels May 8, 2018
@akka-ci
Copy link

akka-ci commented May 8, 2018

Test FAILed.

@akka-ci akka-ci added the needs-attention Indicates a PR validation failure (set by CI infrastructure) label May 8, 2018
@akka-ci
Copy link

akka-ci commented May 8, 2018

Test FAILed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR is currently being validated by Jenkins labels May 8, 2018
@akka-ci
Copy link

akka-ci commented May 8, 2018

Test FAILed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR is currently being validated by Jenkins labels May 8, 2018
@akka-ci
Copy link

akka-ci commented May 8, 2018

Test FAILed.

@chbatey
Copy link
Member Author

chbatey commented May 8, 2018

@patriknw this is ready for a proper review now for the scaladsl. I am now just doing the javadsl but taking a little longer than expected as our java persistent actor tests haven't been running and need some attention.

@akka-ci akka-ci added the validating PR is currently being validated by Jenkins label May 9, 2018
@akka-ci akka-ci removed the validating PR is currently being validated by Jenkins label May 13, 2018
@akka-ci
Copy link

akka-ci commented May 13, 2018

Test PASSed.

Copy link
Member

@johanandren johanandren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, some minor things noted

} else {
// Tags always need to be on the outside as journals match on it
Tagged(setup.eventAdapter.toJournal(event), tags)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the common logic outside of the if-else?

* The `callback` function is called to notify the actor that the recovery process
* is finished. The default implementation logs failures at error and success writes at
* debug.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scaladoc documents something else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh

/**
* The `callback` function is called to notify the actor that the recovery process
* is finished.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also seems wrong

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh

/**
* Transform the event in another type before giving to the journal. Can be used to wrap events
* in types Journals and Adapters understand as well as simple event migrations.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could it be used to do migration? If you already have the events they won't be adapted? Remove or clarify?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@chbatey chbatey changed the title WIP: Typed persistent event adapters/wrappers Typed persistent event adapters/wrappers May 17, 2018
@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR is currently being validated by Jenkins labels May 17, 2018
@akka-ci
Copy link

akka-ci commented May 17, 2018

Test PASSed.

@patriknw patriknw added the 2 - pick next Used to mark issues which are next up in the queue to be worked on. The tag is non-binding label May 21, 2018
Copy link
Member

@johanandren johanandren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but needs some rebasing now.

@chbatey
Copy link
Member Author

chbatey commented May 25, 2018

Rebased and can be merged once validation passes

@akka-ci akka-ci added validating PR is currently being validated by Jenkins and removed tested PR that was successfully built and tested by Jenkins labels May 25, 2018
@chbatey
Copy link
Member Author

chbatey commented May 25, 2018

This also fixes #24637

@akka-ci akka-ci added tested PR that was successfully built and tested by Jenkins and removed validating PR is currently being validated by Jenkins labels May 25, 2018
@akka-ci
Copy link

akka-ci commented May 25, 2018

Test PASSed.

@chbatey chbatey merged commit 8eb7b1e into akka:master May 25, 2018
@chbatey chbatey deleted the typed-event-wrappers branch May 25, 2018 09:23
@chbatey chbatey added this to the 2.5.13 milestone May 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - pick next Used to mark issues which are next up in the queue to be worked on. The tag is non-binding tested PR that was successfully built and tested by Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants