-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Query mechanism for Akka.Persistence SQL-based journals #1306
Conversation
Weird... why didn't the build server pick this up? |
Ah, figured it out - the timestamp of this commit is from August 18th, so TC won't pick it up. Could do the following and update the timestamp to present time? http://stackoverflow.com/questions/454734/how-can-one-change-the-timestamp-of-an-old-commit-in-git |
bee63d4
to
ae51135
Compare
@Aaronontheweb all tests except those, which require SQL Server to be initialized, have passed. |
ae51135
to
9c1ae6e
Compare
I've introduced few more changes:
|
error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. |
e791534
to
18a5b98
Compare
Motivation: One of the popular problems related to Akka.Persistence is support for aggregation of events across multiple persisted streams. Since partitioned journals are part of the Akka.Persistence plugin design, this is hard to achieve using generic tools. Instead each journal provider should be allowed to define set of querying operations, it supports. Purpose of this commit is to introduce common set of querying messages to be used by all SQL-backed journals. This has been provided in form of Query message, which can take a collection of IHint parameters, that are used to specify filters around queried events. Currently there are three of them possible: - Query by provided persistence id collection. - Query by provided message manifest - manifest is often correlated with message type, but in this case it's won't take a inheritance rules when filtering a message. - Query by message timestamp range - range can be one-side open or closed one. Range is always left-side inclusive (From) and right-side exclusive (To) in order to avoid resending the same events in sliding window scenarios. In result, journal will emit each IPersistentRepresentation containing an event wrapped in QueryResponse message. End of the transmission will be signaled by QuerySuccess message and any possible errors will cause QueryFailure to used as a reply. Additional changes: In addition this commit fixes issue with concurrent access to SQL transaction by creating a dedicated sql connection object for each request. BREAKING CHANGES: The biggest change is modification of existing SQL table schemas - 'payload_type' field has been renamed to 'manifest' and aditional 'timestamp' field has been added. Another change is a generic 'SqlJournal' class that can be used as base class for incomming journal implementations for any future specific SQL providers. Also dependent types (like 'JournalDbEngine' and 'IQueryBuilder') have been changed to make querying possible.
18a5b98
to
7cd4f79
Compare
@rogeralsing @Aaronontheweb Builds are passing. Could you review the changes? |
Query mechanism for Akka.Persistence SQL-based journals
WARNING: this PR contains breaking changes for SQL-based plugins. After merging, changes should be applied in dependent sql plugins. Querying mechanism should also be documented.
Changes regarding Akka.Persistence
Akka.Persistence
messages from now implement structural equality and meaningfullToString
messages.ITestOutputHelper
for spec output logging.Changes regarding Akka.Persistence.Sql.Common
Query
message. Message may contain set oIHint
instances used to filter the data (currently only Manifest field and collection of PersistenceIds are supported, more to be written in the future). Response is collection ofQueryResponse
messages containing events filtered for query followed byQuerySuccess
message which finishes response transmission. If an error occurred final message send isQueryFailure
messagePayloadType
has been renamed toManifest
. Now it's more general and can contain user defined manifests if necessary.SqlJournal
class. This simplifies further plugin development and handles query messages.Akka.Persistence.Sql.Common.TestKit
that containsSqlJournalQuerySpec
to be inherited by dependent plugins specs in order to verify if querying is working correctly.Changes regarding Akka.Persistence.SqlServer
Akka.Persistence.SqlServer
is again joined into core repo - reason for that is thatAkka.Persistence.Sql.Common
contained dead code, that was not used/tested anywhere in core solution. Me and @rogeralsing agreed that at least one sub-plugin should be presented here.Akka.Persistence.Sql.Common
lib.Warning
level info, if used connection string don't specify MultipleActiveResultSets=True, as it may be reason of future problems. /cc Multiple active result sets exception #1291Error
level if after insertion command will return result other than 1 for any reason (which is not a desired behavior).