Commit graph

260 commits

Author SHA1 Message Date
Patrik Nordwall
a7c43cf573
Config to exclude class prefix from serialize-messages, #24273 (#27517)
* Config to exclude class prefix from serialize-messages, #24273

* Adding no-serialization-verification-needed-class-prefix, with "akka." included
  by default
* This is important now when we disable Java serialization by default.
  There will be many complaints about Akka internal classes that are not marked with
  NoSerializationVerificationNeeded, and we can't really sprinkle that everywhere.
* Not removing NoSerializationVerificationNeeded usage in Akka classes because that
  may break bin compat, even though it's needed any more.

* fix DisabledJavaSerializerWarningSpec
2019-09-26 22:51:12 +02:00
Patrik Nordwall
1a90e715f5
Cleanup persistence docs, #24717 (#27779) 2019-09-26 22:48:12 +02:00
Patrik Nordwall
1b3a75b3f8 Remove EventSourcedEntity, #27724
Move utils to construct PersistenceId

* Move from EntityTypeKey to PersistenceId
* Thereby no persistence dependencies in sharding
* Reference documentation PersistenceId and how to use with Sharding
* Add EntityTypeKey to EntityContext to make it "complete"
* One consequence of adding EntityTypeKey to EntityContext is that
  now requires additional message type parameter and then type inference
  for `init` (Entity) breaks down. Solved by using two parameter lists in
  Entity.apply, which is pretty nice anyway since the second parameter is
  a function.
* as bonus the dependency can be removed
2019-09-26 11:59:00 +02:00
Renato Cavalcanti
2bab0d8dcd Remove ExpectingReply (#27781)
* remove ExpectingReply

* call method instead of private field

* re-format comments

* formatting

* remove obsolete comment

* remove replyTo()

* remove getters in commands, use immutable fields instead

* Added migration note
2019-09-26 09:45:47 +01:00
Patrik Nordwall
a84aa0095c
Examples of response aggregator and latency tail chopping (#27214) 2019-09-19 12:25:47 +02:00
Patrik Nordwall
733f5fe2b1 doc: stylish persistence.md and persistence-snapshot.md, #24717 2019-09-18 07:48:58 +02:00
Patrik Nordwall
8cb2721c33
Reference docs for SL4J logging in Typed, #27648 (#27696)
* Reference docs for SL4J logging in Typed, #27648
* mention package implicit for LoggerOps
* reference docs of log testing utilities
* cleanup classic logging.md
  * most of it is still relevant, and different enough from
    typed/logging.md to keep it separate
* use ThresholdFilter instead of LevelFilter

Co-Authored-By: Will Sargent <will.sargent@gmail.com>
2019-09-17 17:26:13 +02:00
Patrik Nordwall
68424b4f55 Complete logging with SLF4J in Typed, #26537
* TestAppender interaction with LoggingEventFilter
  * TestAppender plays the same role as classic TestEventList
* replace Sl4jLoggingEvent.java
  * include MDC in testkit.LoggingEvent to allow for custom filter
    testing MDC
* fix tests
* fix log events in BehaviorSetKit, using SubstituteLogger
* MDC in EventSourcedBehavior
  * using raw MDC to set the persistenceId and persistencePhase fields
  * avoid access to MDC ThreadLocal if log isn't used

* Automatically enable eventStream Slf4jLogger for Typed (PR #27583)
  * amend the ActorSystem config on startup when config akka.use-slf4j=on
    and akka-slf4j in classpath
  * akka.use-slf4j is defined in akka-actor-typed reference.conf
  * also enable the Slf4jLoggingFilter automatically
  * remove config in tests

* Include actor path as akkaSource in MDC (PR #27587)
  * move logger init to ActorContextImpl since not specific to untyped (ActorContextAdapter)
  * careful to not access MDC ThreadLocal if logging isn't used (per message)
  * MDC is cleared (if used) from aroundReceive in ActorAdapter after processing each message
  * also changed MDC for EventSourcedBehavior to rely on context.log and the outer MDC.clear()
  * just removing the MDC values is not enough because the empty Map remains in the ThreadLocal

* Optimization of MDC interceptor (PR #27610)

* Extension methods to Logger as workaround for overload and varargs problem (PR #27605)
  * "ambiguous reference to overloaded definition" for 2 arg method
  * varargs not supported for primitive types
  * providing extension methods info2 and infoN (and friends) via implicit class LoggerOps
    as more convenient workaround for these problems

* New API for Typed LoggingEventFilter (PR #27611)
  * builder style
  * will make it easier to add more conditions
  * all conditions are AND:ed together which makes it easier to define custom filters
  * simplifies the implementation as a bonus
  * javadsl
  * use new api in all tests
  * leeway setting
  * verify that occurrences = 0 works
  * use javadsl in two tests
  * change interceptLogger, and some other feedback

* Testing utility to silence logging until failure (PR #27588)
  * Logback appender that captures all log events and can flush them
    later to other appenders
  * LogCapturing mixin for ScalaTest that flush the captured logging events
    when a test fails. Also clears the captured events after all tests.
  * Configuration in logback-test.xml
  * log capturing for JUnit tests too, using TestRule
  * Silence initial setup logging from Logback
  * make LogCapturing public
  * use LogCapturing in all tests
    * aside from multi-jvm, and a few extending AkkaSpec, so far
  * a few doc tests needed debug level

* mention in migration guide
* rename setLoggerClass to setLoggerName
* check for logback dependency to give nicer error message
* fix filterKeys, deprecated in 2.13
2019-09-06 10:09:54 +02:00
Johan Andrén
b68d67008a
Deprecate actor materializer (#27538) 2019-09-05 16:08:37 +02:00
Helena Edelson
29f2eba049 Change "Untyped" to "Classic" (#27627)
* Untyped to classic naming convention #24717
* Added entry of naming convention change to migration docs.
* Rename `toUntyped` to `toClassic` in adapters
2019-09-05 12:30:52 +02:00
Arnout Engelen
70a0af1036
Hook in akka-persistence-typed (#27464) 2019-08-08 10:25:05 +02:00
Christopher Batey
e188b1f653 Migration guide for Persistent FSM to typed persistence (#27336) 2019-07-26 10:01:11 +02:00
Christopher Batey
4f6cccc4d8 Fix stashing of commands when snapshot is in progress (#27389)
* Fix stashing of commands when snapshot is in progress

Fixes #27381

* Naming
2019-07-25 16:32:57 +02:00
Yury Gribkov
a53f1a8101 Change the onWriteRejected and onWriteFailed signature to pass PersistentRepr for context propagation. (#27408) 2019-07-25 10:26:24 +01:00
Arnout Engelen
c4d4dd3875 Persistence typed context (#27404)
* Add context parameters to persistence typed
* Add hooks to capture event-written
2019-07-23 18:47:25 -07:00
Christopher Batey
fe2d1ee917
Snapshot adapter for typed persistence (#27319)
* WIP

* Snapshot adapter for typed persistence

* Pesky java

* Move no op snapshot adapter to internal package

* remove unused import

* More private

* Formatting

* Add cbor serializeable to messages
2019-07-11 16:22:19 +01:00
Patrik Nordwall
3efc1c2877
Disable Java serialization by default, #22333 (#27285)
* akka.actor.allow-java-serialization = off
* Moved primitive (Long, Int, String, ByteString) serializers
  from akka-remote to akka-actor since they had no dependency
  and are useful also in local systems, e.g. persistence.
  * e.g. needed for persistence-tck
  * less allow-java-serialization=on in tests
* CborSerializable in Jackson/test module for ease of use
* JavaSerializable for Java serialization in tests, already in akka-testkit,
  but misconfigured
* Made tests pass
  * allow-java-serialization=on in akka-persistence
  * allow-java-serialization=on in classic remoting tests
  * JavaSerializable and CborSerializable in other remoting tests
* Added serialization for
  * Boolean
  * java.util.concurrent.TimeoutException, AskTimeoutException
* support for testing serialization with the inmem journal
* utility to verifySerialization, in SerializationTestKit
* remove AccountExampleWithCommandHandlersInState becuase not possible to serialize State when it's not static
  * Effect() is factory in EventSourcedBehavior  class
* test the account examples
* SharedLeveldbJournal.configToEnableJavaSerializationForTest
* support for exceptions from remote deployed child actors
  * fallback to akka.remote.serialization.ThrowableNotSerializableException
    if exception is not serializable when wrapped in system messages from
    remote deployed child actors and Status.Failure messages
  * it's implemented in `WrappedPayloadSupport.payloadBuilder`
* update reference documentation
* serialize-messages=off in most places, separate ticket for
  improving or removing that feature
* migration guide, including description of rolling update

* fix 2.13 compiler error

* minor review feedback
2019-07-11 14:04:24 +02:00
Patrik Nordwall
041db6f549 Rename widen to transformMessages, #27253 2019-07-10 14:17:59 +02:00
Christopher Batey
1dfe55fcc3 Typed Stash: Create via factory method on Behaviors (#27200)
* changing to trait in javadsl
2019-07-05 10:28:07 +02:00
Patrik Nordwall
72680e93bf EventSeq in Typed EventAdapter (#27130)
EventSeq in Typed EventAdapter, refs #26909
2019-07-05 09:46:10 +02:00
Patrik Nordwall
f9d76aa030
Log Dropped from DeadLetterListener, #26432 (#27160)
* Log Dropped from DeadLetterListener, #26432

* Move Dropped from akka-actor-typed to akka-actor
* Use it in Artery
* Use in right way from GroupRouter, not via deadLetters
* Remove "without sender" in log message from DeadLetterListener,
  since there is no sender in Typed
* mima filter
* add sender to Dropped
2019-07-04 14:52:42 +02:00
Patrik Nordwall
75e52ba886 Allow widen to be used with EventSourcedBehavior, #25887 (#27251)
* by using a plain BehaviorInterceptor instead of widen
  inside EventSourcedBehaviorImpl
2019-07-03 09:46:37 +02:00
Patrik Nordwall
64fa2979ea
ClassTag in BehaviorInterceptor, #25887 (#27148)
* Always be explicit about what message types an interceptor can handle, to avoid
  ClassCastException if another message type is passing. That may happen when
  the inner behavior understands other messages than it says in it's declared
  behavior type by using narrow. EventSourcedBehaviorImpl is an example.
* Minimized failing tests
* Supervision interceptor is of type Any since failures of all messages must be
  handled
* Changed PoisonPillInterceptor to only intercept signals
* rename type params to Outer and Inner
* separate BehaviorSignalInterceptor
  * which only intercepts signals and messages bypass, e.g. PoisonPillInterceptor
  * also made aroundSignal optional to override in BehaviorInterceptor
* Add test for interceptors combined with EventSourcedBehavior
* ClassTag not needed for LogMessagesInterceptor
  * since it can handle Any
* test supervision of different message type
* clarify low level
* docs for interceptMessageClass param and ClassTag
* remove O type parameter in supervision
* remove extra setup for RestartSupervisor, already factory
* mention in migration guide
2019-07-02 17:49:48 +02:00
Helena Edelson
25b5daa617
Akka Typed Add example of how to java getSelf for persistence typed #27061 (#27196) 2019-06-21 07:30:33 -07:00
Patrik Nordwall
beaa80b773
Merge pull request #26813 from akka/wip-26709-ask-ExpectingReply-patriknw
Type inference for EntityRef.ask, #26709
2019-06-14 11:18:26 +02:00
Christopher Batey
31def7049a Make Behaviors.intercept a factory () => BehaviorInterceptor, #26728 (#27102) 2019-06-14 11:16:12 +02:00
Patrik Nordwall
9e2ea2579b Type inference for EntityRef.ask, #26709
* move AccountExample to Sharding, to be able to test with EntityRef etc
* add tests for AccountExample
* for javadsl there is a problem
* explicity replyTo type solves javadsl issue
* use EventSourcedEntity.withEnforcedReplies
* try replyTo with super type AccountCommandReply
* Reply <: AccountCommandReply
* replace lambda with method (constructor) reference
2019-06-14 10:16:33 +02:00
Patrik Nordwall
5bb83899e7 Remove Behavior.same/empty/etc, #26730 (#27119)
* Removed `Behavior.same`, `Behavior.unhandled`, `Behavior.stopped`, `Behavior.empty`, and `Behavior.ignore` since
  they were redundant with corresponding in Behaviors
* Also moved several of the internal things from Behavior to BehaviorImpl
2019-06-12 09:38:37 +01:00
Patrik Nordwall
10d32fceb9 scheduleWithFixedDelay vs scheduleAtFixedRate, #26910
* previous `schedule` method is trying to maintain a fixed average frequency
  over time, but that can result in undesired bursts of scheduled tasks after a long
  GC or if the JVM process has been suspended, same with all other periodic
  scheduled message sending via various Timer APIs
* most of the time "fixed delay" is more desirable
* we can't just change because it's too big behavioral change and some might
  depend on previous behavior
* deprecate the old `schedule` and introduce new `scheduleWithFixedDelay`
  and `scheduleAtFixedRate`, when fixing the deprecation warning users should
  make a concious decision of which behavior to use (scheduleWithFixedDelay in
  most cases)

* Streams
* SchedulerSpec
  * test both fixed delay and fixed rate
* TimerSpec
* FSM and PersistentFSM
* mima
* runnable as second parameter list, also in typed.Scheduler
* IllegalStateException vs SchedulerException
* deprecated annotations
* api and reference docs, all places
* migration guide
2019-06-05 11:38:04 +02:00
Christopher Batey
bb2b59d7c2
Don't log internal messages as an event (#27014)
* Don't log internal messages as an event
2019-05-29 15:21:16 +01:00
Christopher Batey
37f42d3220 Remove API may change from akka typed (#27027)
Note that it will become fully stable in 2.6.0 so this doesn't mean that there will be no more API changes.

* Remove from event sourced behavior
* Remove api may change settings from typed modules
* Dont check mima for typed until 2.6
2019-05-29 15:38:14 +02:00
Johan Andrén
604523ba18 Specific minimal scheduler API for typed #26971
* migration guide entry
* ManualTime was making assumptions about scheduler
* Add API compile tests for good measure
* named scheduleAtFixedRate instead of schedule
2019-05-24 10:05:53 +02:00
Arnout Engelen
814cfa286c Scala 2.13.0 rc2 (#26967) 2019-05-24 08:11:50 +02:00
Christopher Batey
138ffe25d7
Hooks for Akka Persistence Typed lifecycle (#26999) 2019-05-23 15:10:32 +01:00
Arnout Engelen
dae1870a10
persistentId -> persistenceId 2019-05-14 14:06:55 +02:00
Arnout Engelen
e071077640
Include includes in 'behavior' snippets (#26891) 2019-05-10 09:53:55 +02:00
Johan Andrén
1128024797 Increase timeout to fix PersistentActorJavaDslTest (#26799)
* Increase timeout to fix #26466
2019-05-02 14:21:13 +02:00
Christopher Batey
d17d303110
Remove warnings in persistence typed module (#26748) 2019-04-16 16:12:28 +01:00
Patrik Nordwall
a5e9741d35 replace unicode arrows again (#26732) 2019-04-15 15:40:26 +00:00
Patrik Nordwall
81f11c97dd Make RetentionCritera evolvable, #26545
* allow combining snapshotWhen and RetentionCriteria
* RetentionCritieria unit test
* move retention and snapshot tests to separate EventSourcedBehaviorRetentionSpec
  * because EventSourcedBehaviorSpec is testing too many different things
* Update Scaldoc and reference documentation
  * moved it to the snapshotting page
2019-04-02 15:22:06 +02:00
Helena Edelson
a2f65de599 Typed Persistence: snapshotEvery vs RetentionCriteria #26544 2019-04-02 15:22:06 +02:00
Patrik Nordwall
11a18370c4 unstashAll as terminal Effect, #26489
* Effect.persist(event).thenUnstashAll().thenRun(..) can be misinterpreted
  as the callback of thenRun is invoked when all unstashing has been completed,
  while it is actually running the callback first and the the unstashing process
  follows.
* Unstashing is a process where stashed commands are processed one-by-one
  and waiting for persist effects to complete before processing next.
* Even if we would come up with a way to keep pending callbacks around during
  the unstashing it would probably be complicated for user to reason about it.
  Suddenly a callback is executed from an old command although several other
  commands (that were stashed/unstashed) have been processed inbetween.
* This change makes the unstashAll Effect terminal, meaning that additional
  effects like thenRun can't be added after unstashAll.
* ReplyEffect is also terminal, which makes sense since it's supposed to be
  returned effect. It must still be possible to combine with thenUnstashAll,
  thenReply.thenUnstashAll.
2019-04-02 11:16:28 +02:00
Patrik Nordwall
1120a31e87
include state in EventSourcedBehavior.receiveSignal, #26574 (#26643)
* include state in EventSourcedBehavior.receiveSignal, #26574

* because state type can't be inferred in RecoveryCompleted
* and probably useful to always have access to the state for the signals
* PartialFunction with (state,signal) tuple

* improve how to handle exceptions from signals
2019-04-01 16:33:34 +02:00
Patrik Nordwall
e3251660c8 remove State >: Null constraint in javadsl (#26645)
* it original reason was that this constraint was required by OptionVal,
  but that has been removed
2019-04-01 09:06:37 +01:00
Patrik Nordwall
35729874a6 cleanup logging in persistence tests, #24687 2019-03-28 15:43:31 +01:00
Patrik Nordwall
02e68abae2
Merge pull request #26577 from akka/wip-24687-more-persistence-tests6-patriknw
add more tests for receiving PoisonPill in various states, #24687
2019-03-28 10:07:32 +01:00
Patrik Nordwall
3cbda93496
add EventSourcedBehaviorRecoveryTimeoutSpec, #24687 (#26525)
* include cause message in log error message for recovery failures
2019-03-27 16:23:01 +01:00
Patrik Nordwall
e6775d7225 add more tests for receiving PoisonPill in various states, #24687 2019-03-27 16:21:57 +01:00
Patrik Nordwall
21f765fb86 test PoisonPill and stash of EventSourcedBehavior, #24687
also filter logging in EventSourcedBehaviorStashSpec
2019-03-27 14:59:44 +01:00
Patrik Nordwall
47138bcffd fix compilation error in LoggerSourceTest.java
* slipped in via merge that was tested before the scalatest version update
2019-03-26 15:26:44 +01:00