Skip to content

Commit 45a8010

Browse files
Docs from main to docs/v2.10.2 (#32683)
* docs: fix label for Java Effect.reply and Effect.asyncReply (#32669) * docs: check if license key is valid (#32671) * docs: check if license key is valid * docs: show actual method to retrieve key expiry (#32672) * Doc: update video links in cluster sharding page (#32682) --------- Co-authored-by: Nicola Atzei <natzei@users.noreply.github.com>
1 parent c5146bd commit 45a8010

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

akka-docs/src/main/paradox/general/configuration.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,18 @@ For local development, Akka can be used without a key, but be aware that the `Ac
6161
a while when a key isn't configured.
6262

6363
If the license key has expired when the `ActorSystem` is started the system will terminate after a while.
64-
The expiry date is exposed by @apidoc[akka.actor.typed.ActorSystem] {scala="#licenseKeyExpiry" java="#getLicenseKeyExpiry"}
64+
The expiry date is exposed by @scala[@scaladoc[ActorSystem.licenseKeyExpiry](akka.actor.typed.ActorSystem#licenseKeyExpiry)]@java[@javadoc[ActorSystem.getLicenseKeyExpiry](akka.actor.typed.ActorSystem#getLicenseKeyExpiry())]
6565
so that you can write a test to remind yourself that it is time for renewal before it has expired.
6666

67+
To verify that your license key is still valid (for example during CI/CD integration), you can use the following test
68+
that will start to fail one month before the license key will expire:
69+
70+
Scala
71+
: @@snip [ConfigDocSpec.scala](/akka-docs/src/test/scala/docs/config/ConfigDocSpec.scala) { #check-is-key-valid }
72+
73+
Java
74+
: @@snip [ConfigDocTest.java](/akka-docs/src/test/java/jdocs/config/ConfigDocTest.java) { #check-is-key-valid }
75+
6776
## When using JarJar, OneJar, Assembly or any jar-bundler
6877

6978
@@@ warning

akka-docs/src/main/paradox/typed/cluster-sharding.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ It could for example be actors representing Aggregate Roots in Domain-Driven Des
3838
Here we call these actors "entities". These actors typically have persistent (durable) state,
3939
but this feature is not limited to actors with persistent state.
4040

41-
The [Introduction to Akka Cluster Sharding video](https://akka.io/blog/news/2019/12/16/akka-cluster-sharding-intro-video)
41+
The [Introduction to Akka Cluster Sharding video](https://www.youtube.com/watch?v=SrPubnOKJcQ)
4242
is a good starting point for learning Cluster Sharding.
4343

4444
Cluster sharding is typically used when you have many stateful actors that together consume
@@ -217,7 +217,7 @@ in one rebalance round. The lower result of `rebalance-relative-limit` and `reba
217217
An alternative allocation strategy is the @apidoc[ExternalShardAllocationStrategy] which allows
218218
explicit control over where shards are allocated via the @apidoc[ExternalShardAllocation] extension.
219219

220-
This can be used, for example, to match up Kafka Partition consumption with shard locations. The video [How to co-locate Kafka Partitions with Akka Cluster Shards](https://akka.io/blog/news/2020/03/18/akka-sharding-kafka-video) explains a setup for it. Alpakka Kafka provides [an extension for Akka Cluster Sharding](https://doc.akka.io/libraries/alpakka-kafka/current/cluster-sharding.html).
220+
This can be used, for example, to match up Kafka Partition consumption with shard locations. The video [How to co-locate Kafka Partitions with Akka Cluster Shards](https://www.youtube.com/watch?v=Ad2DyOn4dlY) explains a setup for it. Alpakka Kafka provides [an extension for Akka Cluster Sharding](https://doc.akka.io/libraries/alpakka-kafka/current/cluster-sharding.html).
221221

222222
To use it set it as the allocation strategy on your @apidoc[typed.*.Entity]:
223223

akka-docs/src/main/paradox/typed/persistence.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ and can be one of:
227227
* @scala[@scaladoc[stash](akka.persistence.typed.scaladsl.Effect$#stash[Event,State]():akka.persistence.typed.scaladsl.ReplyEffect[Event,State])]@java[@javadoc[stash](akka.persistence.typed.javadsl.EffectFactories#stash())] the current command is stashed
228228
* @scala[@scaladoc[unstashAll](akka.persistence.typed.scaladsl.Effect$#unstashAll[Event,State]():akka.persistence.typed.scaladsl.Effect[Event,State])]@java[@javadoc[unstashAll](akka.persistence.typed.javadsl.EffectFactories#unstashAll())] process the commands that were stashed with @scala[`Effect.stash`]@java[`Effect().stash`]
229229
* @scala[@scaladoc[reply](akka.persistence.typed.scaladsl.Effect$#reply[ReplyMessage,Event,State](replyTo:akka.actor.typed.ActorRef[ReplyMessage])(replyWithMessage:ReplyMessage):akka.persistence.typed.scaladsl.ReplyEffect[Event,State])]@java[@javadoc[reply](akka.persistence.typed.javadsl.EffectFactories#reply(akka.actor.typed.ActorRef,ReplyMessage))] send a reply message to the given @apidoc[typed.ActorRef]
230-
* @scala[@scaladoc[async](akka.persistence.typed.scaladsl.Effect$#async)]@java[@javadoc[reply](akka.persistence.typed.javadsl.EffectFactories#async)] Asynchronous command handling
231-
* @scala[@scaladoc[asyncReply](akka.persistence.typed.scaladsl.Effect$#asyncReply)]@java[@javadoc[reply](akka.persistence.typed.javadsl.EffectFactories#asyncReply)] Asynchronous command handling and then reply
230+
* @scala[@scaladoc[async](akka.persistence.typed.scaladsl.Effect$#async)]@java[@javadoc[async](akka.persistence.typed.javadsl.EffectFactories#async(java.util.concurrent.CompletionStage))] Asynchronous command handling
231+
* @scala[@scaladoc[asyncReply](akka.persistence.typed.scaladsl.Effect$#asyncReply)]@java[@javadoc[asyncReply](akka.persistence.typed.javadsl.EffectFactories#asyncReply(java.util.concurrent.CompletionStage))] Asynchronous command handling and then reply
232232

233233
Note that only one of those can be chosen per incoming command. It is not possible to both persist and say none/unhandled.
234234

akka-docs/src/test/java/jdocs/config/ConfigDocTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
// #imports
1515
import akka.actor.testkit.typed.javadsl.ActorTestKit;
1616

17+
//#check-is-key-valid
18+
import java.time.LocalDate;
19+
import java.util.Optional;
20+
21+
//#check-is-key-valid
22+
23+
import static org.junit.Assert.*;
24+
1725
public class ConfigDocTest {
1826

1927
private Behavior<Void> rootBehavior = Behaviors.empty();
@@ -67,4 +75,18 @@ public ActorSystem createConfiguredSystem() {
6775
// #custom-config-2
6876
return system;
6977
}
78+
79+
public void compileOnlyIsLicenseKeyValid() {
80+
//#check-is-key-valid
81+
ActorSystem<Void> system = ActorSystem.create(rootBehavior, "name");
82+
Optional<LocalDate> licenseKey = system.getLicenseKeyExpiry();
83+
84+
assertFalse(licenseKey.isEmpty());
85+
86+
LocalDate nextMonth = LocalDate.now().plusMonths(1);
87+
assertTrue(licenseKey.get().isAfter(nextMonth));
88+
89+
system.terminate();
90+
//#check-is-key-valid
91+
}
7092
}

akka-docs/src/test/scala/docs/config/ConfigDocSpec.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,18 @@ class ConfigDocSpec extends AnyWordSpec with Matchers {
109109
val system = ActorSystem(rootBehavior, "MySystem", conf)
110110
ActorTestKit.shutdown(system)
111111
}
112+
113+
def compileOnlyIsLicenseKeyValid(): Unit = {
114+
//#check-is-key-valid
115+
val system = ActorSystem(rootBehavior, "name")
116+
val licenseKey = system.licenseKeyExpiry
117+
licenseKey.isEmpty shouldBe false
118+
119+
import java.time.LocalDate
120+
val nextMonth = LocalDate.now().plusMonths(1)
121+
licenseKey.get.isAfter(nextMonth) shouldBe true
122+
123+
system.terminate()
124+
//#check-is-key-valid
125+
}
112126
}

0 commit comments

Comments
 (0)