Skip to content

Commit d89d153

Browse files
authored
Merge pull request #96 from lerna-stack/untyped-api-is-deprecated
Add deprecated annotation to untyped APIs
2 parents 279b51b + edea593 commit d89d153

20 files changed

+68
-36
lines changed

CHANGELOG.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
⚠️ This change does not allow rolling updates. You have to update your system by stopping the whole cluster.
1515

16+
- Made internal APIs private
17+
18+
If you are only using the APIs using in the implementation guide, this change does not affect your application.
19+
Otherwise, some APIs may be unavailable.
20+
Please see [PR#47](https://github.com/lerna-stack/akka-entity-replication/pull/47) to check APIs that will no longer be available.
21+
1622
### Added
1723
- Java11 support
1824
- Add new typed API based on Akka Typed [PR#79](https://github.com/lerna-stack/akka-entity-replication/pull/79)
1925
- This API reduces runtime errors and increases productivity.
2026

21-
### Removed
27+
### Deprecated
2228

23-
- Made internal APIs private
24-
25-
⚠️ If you are only using the APIs using in the implementation guide, this change does not affect your application.
26-
Otherwise, some APIs may be unavailable.
27-
Please see the following PR to check APIs that will no longer be available.
29+
- Untyped (classic) API has been deprecated [PR#96](https://github.com/lerna-stack/akka-entity-replication/pull/96)
2830

29-
https://github.com/lerna-stack/akka-entity-replication/pull/47
31+
⚠️ This API will be removed in the next major version release.
3032

3133
## [v1.0.0] - 2021-03-29
3234
[v1.0.0]: https://github.com/lerna-stack/akka-entity-replication/compare/v0.1.1...v1.0.0

docs/implementation_guide.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
---
44
**Warning**
55

6-
This API is no longer actively improved.
7-
We will focus to develop [Typed API](./typed/implementation_guide.md).
8-
It is not recommended using this API to build new applications.
6+
This API has been deprecated.
7+
Use [Typed API](./typed/implementation_guide.md) instead to build new applications.
98

109
---
1110

docs/testing_guide.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
---
44
**Warning**
55

6-
This API is no longer actively improved.
7-
We will focus to develop [Typed API](./typed/testing_guide.md).
8-
It is not recommended using this API to build new applications.
6+
This API has been deprecated.
7+
Use [Typed API](./typed/implementation_guide.md) instead to build new applications.
98

109
---
1110

src/main/scala/lerna/akka/entityreplication/ClusterReplication.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class ClusterReplication private (system: ExtendedActorSystem) extends Extension
2929
private[this] lazy val guardian: ActorRef =
3030
system.systemActorOf(ClusterReplicationGuardian.props(), "clusterReplicationGuardian")
3131

32+
@deprecated(message = "Use typed.ClusterReplication.init() instead", since = "2.0.0")
3233
def start(
3334
typeName: String,
3435
entityProps: Props,

src/main/scala/lerna/akka/entityreplication/ClusterReplicationSettings.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import scala.concurrent.duration.FiniteDuration
1111

1212
object ClusterReplicationSettings {
1313

14-
def apply(system: ActorSystem): ClusterReplicationSettings = {
14+
@deprecated("Use typed.ClusterReplicationSettings instead", since = "2.0.0")
15+
def apply(system: ActorSystem): ClusterReplicationSettings = create(system)
16+
17+
// for internal use
18+
private[entityreplication] def create(system: ActorSystem): ClusterReplicationSettings = {
1519
val cluster = Cluster(system)
1620
ClusterReplicationSettingsImpl(system.settings.config, cluster.settings.Roles)
1721
}

src/main/scala/lerna/akka/entityreplication/ReplicationActor.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ private[entityreplication] object ReplicationActor {
1717
private def generateInstanceId(): EntityInstanceId = EntityInstanceId(instanceIdCounter.getAndIncrement())
1818
}
1919

20+
@deprecated(message = "Use typed.ReplicatedEntityBehavior instead", since = "2.0.0")
2021
trait ReplicationActor[StateData] extends Actor with Stash with akka.lerna.StashFactory {
2122
import context.dispatcher
2223

2324
private val internalStash = createStash()
2425

2526
private val instanceId = ReplicationActor.generateInstanceId()
2627

27-
private[this] val settings = ClusterReplicationSettings(context.system)
28+
private[this] val settings = ClusterReplicationSettings.create(context.system)
2829

2930
private[this] val log = Logging(context.system, this)
3031

src/main/scala/lerna/akka/entityreplication/testkit/TestReplicationActorProps.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import lerna.akka.entityreplication.ReplicationActor
66
/**
77
* The [[TestReplicationActorProps]] allows to test [[ReplicationActor]] like a normal Actor.
88
*/
9+
@deprecated(message = "Use typed.testkit.ReplicatedEntityBehaviorTestKit instead", since = "2.0.0")
910
object TestReplicationActorProps {
1011

1112
def apply(replicationActorProps: Props): Props = {

src/main/scala/lerna/akka/entityreplication/typed/internal/ClusterReplicationImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private[entityreplication] class ClusterReplicationImpl(system: ActorSystem[_])
2323

2424
private[this] def internalInit[M, E](entity: ReplicatedEntity[M, E]): ActorRef[E] = {
2525
val classicSystem = system.toClassic
26-
val settings = entity.settings.getOrElse(untyped.ClusterReplicationSettings(classicSystem))
26+
val settings = entity.settings.getOrElse(untyped.ClusterReplicationSettings.create(classicSystem))
2727
val extractEntityId: untyped.ReplicationRegion.ExtractEntityId = {
2828
case ReplicationEnvelope(entityId, message) => (entityId, message)
2929
}

src/main/scala/lerna/akka/entityreplication/typed/internal/behavior/ReplicatedEntityBehaviorImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private[entityreplication] final case class ReplicatedEntityBehaviorImpl[Command
3232

3333
override def apply(ctx: TypedActorContext[Command]): Behavior[Command] = {
3434
try {
35-
val settings = ClusterReplicationSettings(ctx.asScala.system.toClassic)
35+
val settings = ClusterReplicationSettings.create(ctx.asScala.system.toClassic)
3636
Behaviors.intercept(() => interceptor)(createBehavior(entityContext.shard, settings)).narrow
3737
} catch {
3838
case NonFatal(e) =>

src/multi-jvm/scala/lerna/akka/entityreplication/ConsistencyTestBase.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import akka.remote.testconductor.RoleName
44
import akka.remote.testkit.MultiNodeConfig
55
import com.typesafe.config.ConfigFactory
66

7+
import scala.annotation.nowarn
8+
79
object ConsistencyTestBase {
810

911
object ConsistencyTestBaseConfig extends MultiNodeConfig {
@@ -71,6 +73,7 @@ object ConsistencyTestBase {
7173
}
7274
}
7375

76+
@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
7477
class ConsistencyTestReplicationActor() extends ReplicationActor[Int] {
7578

7679
import ConsistencyTestReplicationActor._

0 commit comments

Comments
 (0)