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

EventSeq in Typed EventAdapter, #26909 #27130

Merged
merged 3 commits into from Jul 5, 2019
Merged

Conversation

patriknw
Copy link
Member

  • Tests for usage of EventSeq
  • Moved event adapter tests from EventSourcedBehaviorSpec to
    new EventSourcedEventAdapterSpec
  • Also support for the event adapter manifest
  • Note in migration guide

Refs #26909

@akka-ci akka-ci added the validating PR is currently being validated by Jenkins label Jun 13, 2019
@@ -484,70 +475,6 @@ class EventSourcedBehaviorSpec extends ScalaTestWithActorTestKit(EventSourcedBeh
events shouldEqual List(EventEnvelope(Sequence(1), pid.id, 1, Incremented(1)))
}

"adapt events" in {
Copy link
Member Author

Choose a reason for hiding this comment

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

moved to other test

probe.expectMessage("A1BCD3e")
}

"adapt events" in {
Copy link
Member Author

Choose a reason for hiding this comment

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

below were existing tests that moved here

}

/** INTERNAL API */
@InternalApi private[akka] final case class SingleEventSeq[A](event: A) extends EventSeq[A] {
Copy link
Member Author

Choose a reason for hiding this comment

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

tried to make this AnyVal but not possible since extends EventSeq

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

akka-ci commented Jun 13, 2019

Test FAILed.

@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 needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR is currently being validated by Jenkins labels Jun 13, 2019
@akka-ci
Copy link

akka-ci commented Jun 13, 2019

Test PASSed.

@patriknw patriknw force-pushed the wip-26909-evt-adapter-patriknw branch from 05d67b7 to f72d082 Compare July 2, 2019 10:04
@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 Jul 2, 2019
@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 Jul 2, 2019
@akka-ci
Copy link

akka-ci commented Jul 2, 2019

Test PASSed.

@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 Jul 2, 2019
@akka-ci
Copy link

akka-ci commented Jul 2, 2019

Test PASSed.

* Tests for usage of EventSeq
* Moved event adapter tests from EventSourcedBehaviorSpec to
  new EventSourcedEventAdapterSpec
* Also support for the event adapter manifest
* Note in migration guide
@patriknw patriknw force-pushed the wip-26909-evt-adapter-patriknw branch from adc5251 to decf338 Compare July 3, 2019 09:59
@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 Jul 3, 2019
@akka-ci
Copy link

akka-ci commented Jul 3, 2019

Test PASSed.

@raboof raboof requested review from raboof and chbatey July 4, 2019 14:11
Copy link
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

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

The EventSeq part itself looks great.

The addition of the manifest seems like a good idea, but perhaps it would be good to have a motivating example in the tests?

* <ul>
* <li>extracting events from "envelopes"</li>
* <li>manually converting to the Journals storage format, such as JSON, BSON or any specialised binary format</li>
* <li>adapting incoming events from a "data model" to the "domain model"</li>
Copy link
Member

Choose a reason for hiding this comment

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

Great to make this more clear!

It looks like we're describing this from the toJournal perspective, so perhaps:

Suggested change
* <li>adapting incoming events from a "data model" to the "domain model"</li>
* <li>adapting events from a "domain model" to the "data model"</li>

?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's supposed to describe what it can be used for, in both directions, clarified somewhat in 83e2bbb

* Not used in new records stored with Akka v2.4, but
* old records from v2.3 may have this as `true` if
* it was a non-permanent delete.
*/
def deleted: Boolean

/**
* Sender of this message.
* Not used, can be `null`
Copy link
Member

Choose a reason for hiding this comment

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

Deprecate?

Copy link
Member Author

Choose a reason for hiding this comment

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

created issue #27278

*/
def withManifest(manifest: String): PersistentRepr

/**
* Not used, can always be `false`.
Copy link
Member

Choose a reason for hiding this comment

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

Deprecate?

this
} catch {
case NonFatal(ex) =>
state = state.copy(repr.sequenceNr)
onRecoveryFailure(ex, Some(event))
onRecoveryFailure(ex, Option(eventForErrorReporting.getOrElse(null)))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
onRecoveryFailure(ex, Option(eventForErrorReporting.getOrElse(null)))
onRecoveryFailure(ex, Option(eventForErrorReporting.orNull))

(might be neat to have an toOption on OptionVal?)

Copy link
Member Author

Choose a reason for hiding this comment

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

added in 83e2bbb

import com.typesafe.config.ConfigFactory
import org.scalatest.WordSpecLike

object EventSourcedEventAdapterSpec {
Copy link
Member

Choose a reason for hiding this comment

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

Nice to separate those tests

override def toJournal(e: String): String = e.toUpperCase()

override def fromJournal(p: String, manifest: String): EventSeq[String] = {
EventSeq.single(p + manifest)
Copy link
Member

Choose a reason for hiding this comment

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

Heh, that's a nice hack to be able to verify the manifest was retained... would be nicer to have a test where the manifest is used for something 'real', though.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added the manifest because it is supported in Classic and backend journals support it. It has the same purpose as string manifest in serializers. Leaving it as this here because I don't think it's an important feature.

Copy link
Member

@chbatey chbatey left a comment

Choose a reason for hiding this comment

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

LGTM

@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 Jul 5, 2019
@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 Jul 5, 2019
@akka-ci
Copy link

akka-ci commented Jul 5, 2019

Test PASSed.

@raboof raboof merged commit 72680e9 into master Jul 5, 2019
@raboof raboof deleted the wip-26909-evt-adapter-patriknw branch July 5, 2019 07:46
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