├── .github ├── dependabot.yml ├── release-drafter.yml └── workflows │ ├── codeql.yml │ ├── maven-publish-v6.yml │ ├── maven-publish.yml │ ├── maven-v6.yml │ └── maven.yml ├── .gitignore ├── INSTALL.md ├── LICENSE.txt ├── MULTICAST.md ├── README.md ├── bom └── pom.xml ├── main ├── api │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── elasticsoftware │ │ │ │ └── elasticactors │ │ │ │ ├── Actor.java │ │ │ │ ├── ActorContext.java │ │ │ │ ├── ActorContextHolder.java │ │ │ │ ├── ActorLifecycleListener.java │ │ │ │ ├── ActorNotFoundException.java │ │ │ │ ├── ActorRef.java │ │ │ │ ├── ActorRefGroup.java │ │ │ │ ├── ActorState.java │ │ │ │ ├── ActorSystem.java │ │ │ │ ├── ActorSystemConfiguration.java │ │ │ │ ├── ActorSystems.java │ │ │ │ ├── Asynchronous.java │ │ │ │ ├── ElasticActor.java │ │ │ │ ├── InitialStateProvider.java │ │ │ │ ├── ManagedActor.java │ │ │ │ ├── ManagedActorsRegistry.java │ │ │ │ ├── MessageDeliveryException.java │ │ │ │ ├── MessageHandler.java │ │ │ │ ├── MessageHandlers.java │ │ │ │ ├── MessageHandlersRegistry.java │ │ │ │ ├── MethodActor.java │ │ │ │ ├── PersistentSubscription.java │ │ │ │ ├── PluggableMessageHandlers.java │ │ │ │ ├── PublisherNotFoundException.java │ │ │ │ ├── ServiceActor.java │ │ │ │ ├── SingletonActor.java │ │ │ │ ├── SubscriberContext.java │ │ │ │ ├── SubscriberContextHolder.java │ │ │ │ ├── TempActor.java │ │ │ │ ├── TypedActor.java │ │ │ │ ├── TypedSubscriber.java │ │ │ │ ├── UnexpectedResponseTypeException.java │ │ │ │ ├── UntypedActor.java │ │ │ │ ├── UntypedSubscriber.java │ │ │ │ ├── cluster │ │ │ │ ├── ActorRefFactory.java │ │ │ │ ├── ActorSystemEvent.java │ │ │ │ ├── ActorSystemEventListenerRegistry.java │ │ │ │ ├── RebalancingEventListener.java │ │ │ │ └── scheduler │ │ │ │ │ └── ScheduledMessageRefFactory.java │ │ │ │ ├── concurrent │ │ │ │ ├── ActorCompletableFuture.java │ │ │ │ └── Expirable.java │ │ │ │ ├── logging │ │ │ │ └── LogLevel.java │ │ │ │ ├── package-info.java │ │ │ │ ├── scheduler │ │ │ │ ├── ScheduledMessageRef.java │ │ │ │ └── Scheduler.java │ │ │ │ ├── serialization │ │ │ │ ├── Deserializer.java │ │ │ │ ├── Message.java │ │ │ │ ├── MessageDeserializer.java │ │ │ │ ├── MessageSerializer.java │ │ │ │ ├── MessageToStringConverter.java │ │ │ │ ├── NoopSerializationFramework.java │ │ │ │ ├── SerializationFramework.java │ │ │ │ └── Serializer.java │ │ │ │ ├── state │ │ │ │ ├── ActorLifecycleStep.java │ │ │ │ ├── NullActorState.java │ │ │ │ ├── PersistenceAdvisor.java │ │ │ │ ├── PersistenceConfig.java │ │ │ │ └── PersistenceConfigHelper.java │ │ │ │ └── tracing │ │ │ │ ├── CreationContext.java │ │ │ │ ├── LogContextProcessor.java │ │ │ │ ├── MessageHandlingContext.java │ │ │ │ ├── MessagingContextManager.java │ │ │ │ ├── NoopMessagingScope.java │ │ │ │ ├── TraceContext.java │ │ │ │ ├── Traceable.java │ │ │ │ ├── TracedMessage.java │ │ │ │ └── TracingUtils.java │ │ └── uml │ │ │ ├── actorsystem.uml │ │ │ └── top-level.uml │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ ├── AnotherTestMessage.java │ │ │ ├── MethodActorTest.java │ │ │ ├── TestActorContextHolder.java │ │ │ ├── TestActorState.java │ │ │ ├── TestMessage.java │ │ │ ├── TestMessageHandlers.java │ │ │ ├── TestPersistentMethodActor.java │ │ │ ├── TestSerializationFramework.java │ │ │ └── tracing │ │ │ └── TracingUtilsTest.java │ │ └── resources │ │ └── simplelogger.properties ├── backplane-cassandra-common │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ └── cassandra │ │ └── common │ │ ├── serialization │ │ ├── CompressingSerializer.java │ │ └── DecompressingDeserializer.java │ │ └── state │ │ └── PersistentActorUpdateEvent.java ├── backplane-cassandra2 │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ ├── cassandra2 │ │ ├── cluster │ │ │ ├── CassandraActorSystemEventListenerRepository.java │ │ │ └── scheduler │ │ │ │ └── CassandraScheduledMessageRepository.java │ │ ├── health │ │ │ └── CassandraHealthCheck.java │ │ ├── state │ │ │ ├── CassandraPersistentActorRepository.java │ │ │ └── PersistentActorUpdateEventProcessor.java │ │ └── util │ │ │ └── ExecutionUtils.java │ │ └── configuration │ │ ├── BackplaneConfiguration.java │ │ └── CassandraSessionManager.java ├── backplane-cassandra4 │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ ├── cassandra4 │ │ ├── cluster │ │ │ ├── CassandraActorSystemEventListenerRepository.java │ │ │ └── scheduler │ │ │ │ └── CassandraScheduledMessageRepository.java │ │ ├── health │ │ │ └── CassandraHealthCheck.java │ │ ├── state │ │ │ ├── CassandraPersistentActorRepository.java │ │ │ └── PersistentActorUpdateEventProcessor.java │ │ └── util │ │ │ └── ExecutionUtils.java │ │ └── configuration │ │ ├── BackplaneConfiguration.java │ │ └── CassandraSessionManager.java ├── backplane-redis │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ └── redis │ │ └── state │ │ └── RedisPersistentActorRepository.java ├── base │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── elasticsoftware │ │ │ │ └── elasticactors │ │ │ │ └── base │ │ │ │ ├── actors │ │ │ │ ├── ActorDelegate.java │ │ │ │ ├── AliasActor.java │ │ │ │ ├── JavaScriptActor.java │ │ │ │ └── ReplyActor.java │ │ │ │ ├── serialization │ │ │ │ ├── JacksonActorRefDeserializer.java │ │ │ │ ├── JacksonActorRefSerializer.java │ │ │ │ ├── JacksonActorStateDeserializer.java │ │ │ │ ├── JacksonActorStateSerializer.java │ │ │ │ ├── JacksonMessageDeserializer.java │ │ │ │ ├── JacksonMessageSerializer.java │ │ │ │ ├── JacksonMessageToStringConverter.java │ │ │ │ ├── JacksonScheduledMessageRefDeserializer.java │ │ │ │ ├── JacksonScheduledMessageRefSerializer.java │ │ │ │ ├── JacksonSerializationFramework.java │ │ │ │ └── ObjectMapperBuilder.java │ │ │ │ └── state │ │ │ │ ├── AliasActorState.java │ │ │ │ ├── JacksonActorState.java │ │ │ │ ├── JavaScriptActorState.java │ │ │ │ └── StringState.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── elasticactors.properties │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ ├── TestActorContextHolder.java │ │ │ └── base │ │ │ ├── actors │ │ │ └── JavaScriptActorTest.java │ │ │ └── serialization │ │ │ ├── ObjectMapperBuilderTest.java │ │ │ └── TestObjectWIthJsonSerialize.java │ │ └── resources │ │ └── simplelogger.properties ├── caching │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── caching │ │ │ └── service │ │ │ └── CachingClassLoadingHelper.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.elasticsoftware.elasticactors.util.ClassLoadingHelper ├── client-rabbitmq │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ └── client │ │ └── spring │ │ └── RabbitClientConfiguration.java ├── client-spring-amqp │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ └── client │ │ └── spring │ │ ├── RabbitTemplateMessageQueue.java │ │ ├── RabbitTemplateMessageQueueFactory.java │ │ ├── RabbitTemplateMessageQueueFactoryFactory.java │ │ └── SpringAMQPClientConfiguration.java ├── client │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ └── client │ │ ├── cluster │ │ ├── ActorSystemDelegateConfiguration.java │ │ ├── BaseDisconnectedActorRef.java │ │ ├── DisconnectedRemoteActorNodeRef.java │ │ ├── DisconnectedRemoteActorShardRef.java │ │ ├── DisconnectedServiceActorRef.java │ │ ├── RemoteActorShard.java │ │ ├── RemoteActorShardRef.java │ │ ├── RemoteActorShardRefFactory.java │ │ ├── RemoteActorSystemInstance.java │ │ └── RemoteActorSystems.java │ │ ├── configuration │ │ └── ClientConfiguration.java │ │ ├── messaging │ │ └── ActorSystemMessage.java │ │ ├── serialization │ │ ├── ActorSystemMessageSerializer.java │ │ ├── ClientSerializationFrameworks.java │ │ ├── ClientSystemDeserializers.java │ │ ├── ClientSystemSerializers.java │ │ ├── SerializedActorStateSerializationFramework.java │ │ └── SerializedActorStateSerializer.java │ │ └── state │ │ └── SerializedActorState.java ├── cluster-kubernetes │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ ├── configuration │ │ └── ClusteringConfiguration.java │ │ └── kubernetes │ │ └── cluster │ │ ├── DaemonThreadFactory.java │ │ └── KubernetesClusterService.java ├── cluster-shoal │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ ├── configuration │ │ │ └── ClusteringConfiguration.java │ │ │ └── shoal │ │ │ └── cluster │ │ │ └── ShoalClusterService.java │ │ └── test │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ ├── ClusteringTest.java │ │ └── shoal │ │ └── GMSTest.java ├── core │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── elasticsoftware │ │ │ │ └── elasticactors │ │ │ │ ├── cache │ │ │ │ ├── CacheManager.java │ │ │ │ ├── NodeActorCacheManager.java │ │ │ │ └── ShardActorCacheManager.java │ │ │ │ ├── cluster │ │ │ │ ├── AbstractActorContainer.java │ │ │ │ ├── ActorRefTools.java │ │ │ │ ├── ActorShardRef.java │ │ │ │ ├── ActorSystemEventListenerImpl.java │ │ │ │ ├── ActorSystemEventRegistryImpl.java │ │ │ │ ├── BaseActorRef.java │ │ │ │ ├── BaseDisconnectedActorRef.java │ │ │ │ ├── DisconnectedActorNodeRef.java │ │ │ │ ├── DisconnectedRemoteActorNodeRef.java │ │ │ │ ├── DisconnectedRemoteActorShardRef.java │ │ │ │ ├── DisconnectedServiceActorRef.java │ │ │ │ ├── LocalActorNode.java │ │ │ │ ├── LocalActorRefGroup.java │ │ │ │ ├── LocalActorShard.java │ │ │ │ ├── LocalActorSystemInstance.java │ │ │ │ ├── LocalClusterActorNodeRef.java │ │ │ │ ├── NodeSelectorHasher.java │ │ │ │ ├── RemoteActorNode.java │ │ │ │ ├── RemoteActorShard.java │ │ │ │ ├── RemoteActorSystemActorShard.java │ │ │ │ ├── RemoteActorSystemInstance.java │ │ │ │ ├── RemoteActorSystems.java │ │ │ │ ├── RemoteClusterActorNodeRef.java │ │ │ │ ├── ServiceActorRef.java │ │ │ │ ├── logging │ │ │ │ │ ├── LoggingSettings.java │ │ │ │ │ └── MessageLogger.java │ │ │ │ ├── messaging │ │ │ │ │ └── ShardReleasedMessage.java │ │ │ │ ├── metrics │ │ │ │ │ ├── MapMicrometerTagCustomizer.java │ │ │ │ │ ├── Measurement.java │ │ │ │ │ ├── MetricsSettings.java │ │ │ │ │ ├── MicrometerConfiguration.java │ │ │ │ │ └── MicrometerTagCustomizer.java │ │ │ │ ├── protobuf │ │ │ │ │ └── Clustering.java │ │ │ │ ├── scheduler │ │ │ │ │ ├── DisconnectedRemoteScheduledMessageRef.java │ │ │ │ │ ├── ScheduledMessageRefTools.java │ │ │ │ │ ├── ScheduledMessageShardRef.java │ │ │ │ │ ├── ShardedScheduler.java │ │ │ │ │ ├── SimpleScheduledMessageRef.java │ │ │ │ │ └── SimpleScheduler.java │ │ │ │ ├── strategies │ │ │ │ │ ├── MultiNodeScaleUpStrategy.java │ │ │ │ │ ├── RunningNodeScaleDownStrategy.java │ │ │ │ │ ├── RunningNodeScaleUpStrategy.java │ │ │ │ │ ├── SingleNodeScaleUpStrategy.java │ │ │ │ │ └── StartingNodeScaleUpStrategy.java │ │ │ │ └── tasks │ │ │ │ │ ├── ActivateActorTask.java │ │ │ │ │ ├── ActivateServiceActorTask.java │ │ │ │ │ ├── ActorLifecycleTask.java │ │ │ │ │ ├── CreateActorTask.java │ │ │ │ │ ├── DestroyActorTask.java │ │ │ │ │ ├── HandleServiceMessageTask.java │ │ │ │ │ ├── HandleUndeliverableServiceMessageTask.java │ │ │ │ │ ├── InternalActorContext.java │ │ │ │ │ ├── PassivateActorTask.java │ │ │ │ │ ├── PersistActorTask.java │ │ │ │ │ ├── ProtocolFactory.java │ │ │ │ │ ├── ProtocolFactoryFactory.java │ │ │ │ │ ├── app │ │ │ │ │ ├── ApplicationProtocolFactory.java │ │ │ │ │ ├── HandleMessageTask.java │ │ │ │ │ └── HandleUndeliverableMessageTask.java │ │ │ │ │ └── reactivestreams │ │ │ │ │ ├── InternalSubscriberContext.java │ │ │ │ │ ├── ReactiveHandleMessageTask.java │ │ │ │ │ ├── ReactiveHandleUndeliverableMessageTask.java │ │ │ │ │ └── ReactiveStreamsProtocolFactory.java │ │ │ │ ├── core │ │ │ │ └── actors │ │ │ │ │ ├── AskReplyActor.java │ │ │ │ │ ├── CompletableFutureDelegate.java │ │ │ │ │ ├── InternalActorDelegate.java │ │ │ │ │ ├── SubscriberActor.java │ │ │ │ │ └── SubscriberState.java │ │ │ │ ├── messaging │ │ │ │ └── MultiMessageHandlerEventListener.java │ │ │ │ ├── reactivestreams │ │ │ │ └── PersistentSubscriptionImpl.java │ │ │ │ ├── serialization │ │ │ │ ├── internal │ │ │ │ │ ├── ActorSystemEventListenerDeserializer.java │ │ │ │ │ ├── ActorSystemEventListenerSerializer.java │ │ │ │ │ ├── PersistentActorDeserializer.java │ │ │ │ │ └── PersistentActorSerializer.java │ │ │ │ └── protobuf │ │ │ │ │ └── Elasticactors.java │ │ │ │ ├── state │ │ │ │ ├── ActorStateUpdateEvent.java │ │ │ │ ├── ActorStateUpdateProcessor.java │ │ │ │ ├── DefaultActorStateUpdateProcessor.java │ │ │ │ └── NoopActorStateUpdateProcessor.java │ │ │ │ ├── test │ │ │ │ └── TestActorSystemsInstance.java │ │ │ │ └── util │ │ │ │ ├── ArrayUtils.java │ │ │ │ ├── EnvironmentUtils.java │ │ │ │ ├── ManifestTools.java │ │ │ │ └── concurrent │ │ │ │ ├── BlockingQueueThreadBoundExecutor.java │ │ │ │ ├── DaemonThreadFactory.java │ │ │ │ ├── MessageHandlingThreadBoundRunnable.java │ │ │ │ ├── ThreadBoundEvent.java │ │ │ │ ├── ThreadBoundEventProcessor.java │ │ │ │ ├── ThreadBoundExecutor.java │ │ │ │ ├── ThreadBoundExecutorBuilder.java │ │ │ │ ├── ThreadBoundRunnable.java │ │ │ │ ├── ThreadBoundRunnableEventProcessor.java │ │ │ │ ├── WrapperThreadBoundRunnable.java │ │ │ │ ├── disruptor │ │ │ │ ├── DisruptorThreadBoundExecutor.java │ │ │ │ ├── ThreadBoundEventHandler.java │ │ │ │ ├── ThreadBoundEventWrapper.java │ │ │ │ └── ThreadBoundEventWrapperFactory.java │ │ │ │ └── metrics │ │ │ │ ├── CountingTimedThreadBoundExecutor.java │ │ │ │ ├── DelegatingTimedThreadBoundExecutor.java │ │ │ │ ├── ThreadBoundExecutorMonitor.java │ │ │ │ ├── TimedThreadBoundEvent.java │ │ │ │ ├── TimedThreadBoundExecutor.java │ │ │ │ ├── TimedThreadBoundRunnable.java │ │ │ │ └── TraceThreadBoundRunnable.java │ │ ├── protobuf │ │ │ ├── clustering.proto │ │ │ └── elasticactors.proto │ │ └── resources │ │ │ └── META-INF │ │ │ └── elasticactors.properties │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ ├── cluster │ │ │ ├── ActorRefToolsTest.java │ │ │ └── scheduler │ │ │ │ └── ScheduledMessageRefToolsTest.java │ │ │ ├── messaging │ │ │ └── UUIDToolsTest.java │ │ │ └── serialization │ │ │ ├── SerializationContextTest.java │ │ │ └── internal │ │ │ └── CreateActorMessageSerializationTest.java │ │ └── resources │ │ └── simplelogger.properties ├── elasticactors-kafka-testapp │ ├── pom.xml │ └── src │ │ ├── config │ │ ├── config.yaml │ │ ├── simplelogger.properties │ │ └── system.properties │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── kafka │ │ │ └── testapp │ │ │ ├── KafkaTestApplication.java │ │ │ ├── actors │ │ │ └── VirtualCashAccountActor.java │ │ │ ├── configuration │ │ │ └── ContainerConfiguration.java │ │ │ ├── messages │ │ │ ├── ActivateAccountCommand.java │ │ │ ├── BalanceQuery.java │ │ │ ├── CreditAccountEvent.java │ │ │ ├── DebitAccountEvent.java │ │ │ ├── ScheduleDebitCommand.java │ │ │ ├── TransferCommand.java │ │ │ └── VirtualCashAccountAdapter.java │ │ │ └── state │ │ │ └── VirtualCashAccountState.java │ │ └── resources │ │ ├── META-INF │ │ └── elasticactors.properties │ │ └── simplelogger.properties ├── elasticactors-kafka │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── kafka │ │ │ ├── InternalActorContext.java │ │ │ ├── KafkaActorNode.java │ │ │ ├── KafkaActorShard.java │ │ │ ├── KafkaActorSystemInstance.java │ │ │ ├── KafkaActorThread.java │ │ │ ├── KafkaTransactionContext.java │ │ │ ├── ManagedActorContainer.java │ │ │ ├── ServiceActorContext.java │ │ │ ├── cluster │ │ │ ├── ActorLifecycleFunction.java │ │ │ ├── ApplicationProtocol.java │ │ │ ├── DisconnectedPartitionedActorNodeRef.java │ │ │ ├── InternalSubscriberContext.java │ │ │ ├── KafkaActorRefTools.java │ │ │ ├── KafkaInternalActorSystems.java │ │ │ ├── LocalClusterPartitionedActorNodeRef.java │ │ │ ├── ReactiveStreamsProtocol.java │ │ │ └── SubscriberContextImpl.java │ │ │ ├── configuration │ │ │ └── NodeConfiguration.java │ │ │ ├── scheduler │ │ │ └── KafkaTopicScheduler.java │ │ │ ├── serialization │ │ │ ├── CompressingSerializer.java │ │ │ ├── DecompressingDeserializer.java │ │ │ ├── KafkaActorSystemEventListenerDeserializer.java │ │ │ ├── KafkaInternalMessageDeserializer.java │ │ │ ├── KafkaInternalMessageSerializer.java │ │ │ ├── KafkaPersistentActorSerializer.java │ │ │ ├── KafkaProducerSerializer.java │ │ │ ├── KafkaScheduledMessageDeserializer.java │ │ │ ├── UUIDDeserializer.java │ │ │ └── UUIDSerializer.java │ │ │ ├── state │ │ │ ├── ChronicleMapPersistentActorStore.java │ │ │ ├── ChronicleMapPersistentActorStoreFactory.java │ │ │ ├── InMemoryPeristentActorStoreFactory.java │ │ │ ├── InMemoryPersistentActorStore.java │ │ │ ├── PersistentActorStore.java │ │ │ └── PersistentActorStoreFactory.java │ │ │ └── utils │ │ │ ├── TopicHelper.java │ │ │ └── TopicNamesHelper.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── kafka │ │ │ ├── KafkaAdminClientTest.java │ │ │ ├── TestApplication.java │ │ │ └── configuration │ │ │ └── ContainerConfiguration.java │ │ └── resources │ │ ├── config.yaml │ │ ├── simplelogger.properties │ │ └── system.properties ├── indexing-elasticsearch │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── indexing │ │ │ └── elasticsearch │ │ │ ├── IndexConfig.java │ │ │ ├── IndexderAppConfig.java │ │ │ └── indexer │ │ │ └── Indexer.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── indexing │ │ │ └── elasticsearch │ │ │ └── indexer │ │ │ └── IndexerTest.java │ │ └── resources │ │ └── simplelogger.properties ├── messaging-activemq │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ ├── activemq │ │ ├── ActiveMQArtemisMessagingService.java │ │ ├── LocalMessageQueue.java │ │ └── RemoteMessageQueue.java │ │ └── configuration │ │ └── MessagingConfiguration.java ├── messaging-rabbitmq │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ ├── configuration │ │ │ └── MessagingConfiguration.java │ │ │ └── rabbitmq │ │ │ ├── ChannelListenerRegistry.java │ │ │ ├── LoggingShutdownListener.java │ │ │ ├── MessageAcker.java │ │ │ ├── RabbitMQMessagingService.java │ │ │ ├── ack │ │ │ ├── AsyncMessageAcker.java │ │ │ ├── BufferingMessageAcker.java │ │ │ ├── DirectMessageAcker.java │ │ │ └── WriteBehindMessageAcker.java │ │ │ ├── cpt │ │ │ ├── LocalMessageQueue.java │ │ │ ├── MultiProducerRabbitMQMessagingService.java │ │ │ └── RemoteMessageQueue.java │ │ │ ├── health │ │ │ └── RabbitMQHealthCheck.java │ │ │ └── sc │ │ │ ├── LocalMessageQueue.java │ │ │ ├── RemoteMessageQueue.java │ │ │ └── SingleProducerRabbitMQMessagingService.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── rabbitmq │ │ │ ├── BufferingMessageAckerTest.java │ │ │ └── RabbitMQMessagingServiceTest.java │ │ └── resources │ │ └── simplelogger.properties ├── messaging │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ ├── messaging │ │ │ ├── AbstractTracedMessage.java │ │ │ ├── ActorShardHasher.java │ │ │ ├── DefaultInternalMessage.java │ │ │ ├── ImmutableInternalMessage.java │ │ │ ├── InternalMessageFactory.java │ │ │ ├── MessageQueueProxy.java │ │ │ ├── MultiMessageQueueProxy.java │ │ │ ├── MultiMessageQueueProxyHasher.java │ │ │ ├── ScheduledMessageImpl.java │ │ │ ├── SingleMessageQueueProxy.java │ │ │ ├── Splittable.java │ │ │ ├── SplittableUtils.java │ │ │ ├── TransientInternalMessage.java │ │ │ ├── UUIDTools.java │ │ │ ├── internal │ │ │ │ ├── ActivateActorMessage.java │ │ │ │ ├── ActorNodeMessage.java │ │ │ │ ├── ActorType.java │ │ │ │ ├── CancelScheduledMessageMessage.java │ │ │ │ ├── CreateActorMessage.java │ │ │ │ ├── DestroyActorMessage.java │ │ │ │ ├── InternalHashKeyUtils.java │ │ │ │ ├── MessageQueueBoundPayload.java │ │ │ │ └── PersistActorMessage.java │ │ │ └── reactivestreams │ │ │ │ ├── CancelMessage.java │ │ │ │ ├── CompletedMessage.java │ │ │ │ ├── NextMessage.java │ │ │ │ ├── ReactiveStreamsProtocol.java │ │ │ │ ├── RequestMessage.java │ │ │ │ ├── SubscribeMessage.java │ │ │ │ └── SubscriptionMessage.java │ │ │ ├── serialization │ │ │ ├── MessagingSystemDeserializers.java │ │ │ ├── MessagingSystemSerializers.java │ │ │ ├── SerializationContext.java │ │ │ ├── SystemDeserializers.java │ │ │ ├── SystemSerializationFramework.java │ │ │ ├── SystemSerializers.java │ │ │ ├── internal │ │ │ │ ├── ActivateActorMessageDeserializer.java │ │ │ │ ├── ActivateActorMessageSerializer.java │ │ │ │ ├── ActorNodeMessageDeserializer.java │ │ │ │ ├── ActorNodeMessageSerializer.java │ │ │ │ ├── ActorRefDeserializer.java │ │ │ │ ├── ActorRefSerializer.java │ │ │ │ ├── CancelScheduleMessageMessageSerializer.java │ │ │ │ ├── CancelScheduledMessageMessageDeserializer.java │ │ │ │ ├── CreateActorMessageDeserializer.java │ │ │ │ ├── CreateActorMessageSerializer.java │ │ │ │ ├── DestroyActorMessageDeserializer.java │ │ │ │ ├── DestroyActorMessageSerializer.java │ │ │ │ ├── InternalMessageDeserializer.java │ │ │ │ ├── InternalMessageSerializer.java │ │ │ │ ├── PersistActorMessageDeserializer.java │ │ │ │ ├── PersistActorMessageSerializer.java │ │ │ │ ├── ScheduledMessageDeserializer.java │ │ │ │ ├── ScheduledMessageSerializer.java │ │ │ │ └── tracing │ │ │ │ │ ├── CreationContextDeserializer.java │ │ │ │ │ ├── CreationContextSerializer.java │ │ │ │ │ ├── TraceContextDeserializer.java │ │ │ │ │ └── TraceContextSerializer.java │ │ │ ├── protobuf │ │ │ │ ├── Messaging.java │ │ │ │ └── Reactivestreams.java │ │ │ └── reactivestreams │ │ │ │ ├── CancelMessageDeserializer.java │ │ │ │ ├── CancelMessageSerializer.java │ │ │ │ ├── CompletedMessageDeserializer.java │ │ │ │ ├── CompletedMessageSerializer.java │ │ │ │ ├── NextMessageDeserializer.java │ │ │ │ ├── NextMessageSerializer.java │ │ │ │ ├── RequestMessageDeserializer.java │ │ │ │ ├── RequestMessageSerializer.java │ │ │ │ ├── SubscribeMessageDeserializer.java │ │ │ │ ├── SubscribeMessageSerializer.java │ │ │ │ ├── SubscriptionMessageDeserializer.java │ │ │ │ └── SubscriptionMessageSerializer.java │ │ │ └── util │ │ │ ├── ByteBufferUtils.java │ │ │ ├── ClassLoadingHelper.java │ │ │ └── SerializationTools.java │ │ └── protobuf │ │ ├── messaging.proto │ │ └── reactivestreams.proto ├── pom.xml ├── runtime │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── elasticsoftware │ │ │ │ └── elasticactors │ │ │ │ ├── cluster │ │ │ │ ├── ConsistentHash.java │ │ │ │ ├── HashingNodeSelector.java │ │ │ │ └── HashingNodeSelectorFactory.java │ │ │ │ ├── configuration │ │ │ │ ├── AppConfiguration.java │ │ │ │ └── NodeConfiguration.java │ │ │ │ ├── health │ │ │ │ └── InternalActorSystemHealthCheck.java │ │ │ │ ├── runtime │ │ │ │ ├── ActorLifecycleListenerScanner.java │ │ │ │ ├── DefaultConfiguration.java │ │ │ │ ├── DefaultRemoteConfiguration.java │ │ │ │ ├── ElasticActorsBootstrapper.java │ │ │ │ ├── ElasticActorsNode.java │ │ │ │ ├── ManagedActorsScanner.java │ │ │ │ ├── MessagesScanner.java │ │ │ │ ├── PluggableMessageHandlersRegistry.java │ │ │ │ ├── PluggableMessageHandlersScanner.java │ │ │ │ └── ScannerHelper.java │ │ │ │ └── spring │ │ │ │ ├── ActorAnnotationBeanNameGenerator.java │ │ │ │ ├── ActorSystemApplicationContextInitializer.java │ │ │ │ ├── AnnotationConfigApplicationContext.java │ │ │ │ ├── AnnotationConfigWebApplicationContext.java │ │ │ │ └── ElasticActorsContextLoaderListener.java │ │ └── resources │ │ │ └── ea-default.yaml │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ ├── cluster │ │ │ └── HashingNodeSelectorTest.java │ │ │ ├── runtime │ │ │ └── DefaultConfigurationTest.java │ │ │ └── test │ │ │ ├── TestActor.java │ │ │ └── TestActorFullName.java │ │ └── resources │ │ ├── ea-test.yaml │ │ └── simplelogger.properties ├── spi │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ ├── ActorContainer.java │ │ ├── ActorContainerRef.java │ │ ├── ActorLifecycleListenerRegistry.java │ │ ├── ActorNode.java │ │ ├── ActorShard.java │ │ ├── InternalActorSystemConfiguration.java │ │ ├── NodeKey.java │ │ ├── PhysicalNode.java │ │ ├── RemoteActorSystemConfiguration.java │ │ ├── ShardKey.java │ │ ├── cache │ │ └── EvictionListener.java │ │ ├── cluster │ │ ├── ActorSystemEventListener.java │ │ ├── ActorSystemEventListenerRepository.java │ │ ├── ActorSystemEventListenerService.java │ │ ├── ClusterEventListener.java │ │ ├── ClusterMessageHandler.java │ │ ├── ClusterService.java │ │ ├── InternalActorSystem.java │ │ ├── InternalActorSystemEventListenerRegistry.java │ │ ├── InternalActorSystems.java │ │ ├── NodeSelector.java │ │ ├── NodeSelectorFactory.java │ │ ├── ShardAccessor.java │ │ ├── ShardDistributionStrategy.java │ │ ├── ShardDistributor.java │ │ └── scheduler │ │ │ ├── InternalScheduler.java │ │ │ ├── ScheduledMessage.java │ │ │ ├── ScheduledMessageKey.java │ │ │ ├── ScheduledMessageRepository.java │ │ │ └── SchedulerService.java │ │ ├── health │ │ ├── HealthCheck.java │ │ └── HealthCheckResult.java │ │ ├── messaging │ │ ├── Hasher.java │ │ ├── InternalMessage.java │ │ ├── MessageHandler.java │ │ ├── MessageHandlerEventListener.java │ │ ├── MessageQueue.java │ │ ├── MessageQueueEventListener.java │ │ ├── MessageQueueFactory.java │ │ ├── MessageQueueFactoryFactory.java │ │ ├── MessagingService.java │ │ └── MessagingServiceInitializationException.java │ │ ├── reactivestreams │ │ ├── InternalPersistentSubscription.java │ │ └── ProcessorContext.java │ │ ├── serialization │ │ ├── SerializationAccessor.java │ │ └── SerializationFrameworks.java │ │ └── state │ │ ├── ActorStateUpdate.java │ │ ├── ActorStateUpdateListener.java │ │ ├── MessageSubscriber.java │ │ ├── PersistentActor.java │ │ └── PersistentActorRepository.java ├── test │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── test │ │ │ ├── TestActorSystem.java │ │ │ ├── TestInternalActorSystems.java │ │ │ ├── cluster │ │ │ ├── NoopActorSystemEventRegistryService.java │ │ │ ├── SingleNodeClusterService.java │ │ │ ├── UnsupportedThreadBoundExecutor.java │ │ │ └── scheduler │ │ │ │ └── NoopScheduledMessageRepository.java │ │ │ ├── configuration │ │ │ ├── BackplaneConfiguration.java │ │ │ ├── ClientConfiguration.java │ │ │ ├── MessagingConfiguration.java │ │ │ ├── SystemInitializer.java │ │ │ └── TestConfiguration.java │ │ │ ├── messaging │ │ │ ├── LocalMessageQueue.java │ │ │ ├── TestMessagingService.java │ │ │ ├── UnsupportedMessageQueueFactory.java │ │ │ └── UnsupportedMessageQueueFactoryFactory.java │ │ │ └── state │ │ │ ├── LoggingActorStateUpdateListener.java │ │ │ └── NoopPersistentActorRepository.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── test │ │ │ ├── ContextTest.java │ │ │ ├── ContextTestConfiguration.java │ │ │ ├── ManagedActorTest.java │ │ │ ├── ManifestToolsTest.java │ │ │ ├── SingletonActorTest.java │ │ │ ├── ask │ │ │ ├── ActorCompletableFutureTest.java │ │ │ ├── AfterHandlers.java │ │ │ ├── AskForGreeting.java │ │ │ ├── AskForGreetingActor.java │ │ │ ├── AskTest.java │ │ │ └── BeforeHandlers.java │ │ │ ├── common │ │ │ ├── CacheExpirationTest.java │ │ │ ├── CurrentActorName.java │ │ │ ├── EchoGreetingActor.java │ │ │ ├── ExclusiveManagedNameActor.java │ │ │ ├── GetActorName.java │ │ │ ├── Greeting.java │ │ │ ├── GreetingActor.java │ │ │ ├── GreetingTest.java │ │ │ ├── IScheduledGreeting.java │ │ │ ├── InitialNameStateProvider.java │ │ │ ├── ManagedNameActor.java │ │ │ ├── NameActorState.java │ │ │ ├── ScheduledGreeting.java │ │ │ ├── SetActorName.java │ │ │ ├── SingletonNameActor.java │ │ │ └── SpecialGreeting.java │ │ │ └── reactivestreams │ │ │ ├── AnonymousSubscriberTest.java │ │ │ ├── ReactiveStreamsTest.java │ │ │ ├── StreamFinishedMessage.java │ │ │ ├── StreamedMessage.java │ │ │ ├── TestPublisher.java │ │ │ ├── TestSubscriber.java │ │ │ └── UnsupportedPublishersTest.java │ │ └── resources │ │ ├── META-INF │ │ └── elasticactors.properties │ │ ├── ea-test.yaml │ │ ├── log4j2-test.xml │ │ ├── simplelogger.properties │ │ └── system.properties ├── tracing-slf4j │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── elasticsoftware │ │ │ └── elasticactors │ │ │ └── tracing │ │ │ └── service │ │ │ └── Slf4jLogContextProcessor.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.elasticsoftware.elasticactors.tracing.LogContextProcessor ├── tracing-spring │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ └── tracing │ │ └── spring │ │ ├── AsyncDefaultConfiguration.java │ │ ├── ExecutorBeanPostProcessor.java │ │ ├── LazyTraceAsyncTaskExecutor.java │ │ ├── LazyTraceExecutor.java │ │ ├── LazyTraceScheduledThreadPoolExecutor.java │ │ ├── LazyTraceThreadPoolTaskExecutor.java │ │ ├── LazyTraceThreadPoolTaskScheduler.java │ │ ├── TraceCallable.java │ │ ├── TraceRunnable.java │ │ ├── TraceableExecutorService.java │ │ ├── TraceableScheduledExecutorService.java │ │ └── package-info.java └── tracing │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── org │ │ └── elasticsoftware │ │ └── elasticactors │ │ └── tracing │ │ └── service │ │ └── TracingMessagingContextManager.java │ └── resources │ └── META-INF │ └── services │ └── org.elasticsoftware.elasticactors.tracing.MessagingContextManager └── pom.xml /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "maven" # See documentation for possible values 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: 'v$RESOLVED_VERSION 🌈' 2 | tag-template: 'v$RESOLVED_VERSION' 3 | categories: 4 | - title: '🚀 Features' 5 | labels: 6 | - 'feature' 7 | - 'enhancement' 8 | - title: '🐛 Bug Fixes' 9 | labels: 10 | - 'fix' 11 | - 'bugfix' 12 | - 'bug' 13 | - title: '🧰 Maintenance' 14 | label: 'chore' 15 | change-template: '- $TITLE @$AUTHOR (#$NUMBER)' 16 | change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. 17 | version-resolver: 18 | major: 19 | labels: 20 | - 'major' 21 | minor: 22 | labels: 23 | - 'minor' 24 | patch: 25 | labels: 26 | - 'patch' 27 | default: patch 28 | template: | 29 | ## Changes 30 | 31 | $CHANGES -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Package Files # 4 | *.jar 5 | *.war 6 | *.ear 7 | 8 | # IntelliJ 9 | .idea/ 10 | *.iml 11 | 12 | # Eclipse 13 | .classpath 14 | .project 15 | .settings 16 | 17 | # Other stuff 18 | *.bat 19 | target/ 20 | 21 | *.versionsBackup 22 | *.releaseBackup 23 | release.properties -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | Install on Debian Squeeze (minimal required steps) 2 | ============= 3 | sudo apt-get install ntp 4 | echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list 5 | echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list 6 | apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 7 | apt-get update 8 | apt-get install oracle-java7-installer 9 | # cassandra install 10 | sudo apt-get install libjna-java 11 | # add the following 2 lines to /etc/apt/sources.list.d/cassandra.sources.list 12 | deb http://www.apache.org/dist/cassandra/debian 12x main 13 | deb-src http://www.apache.org/dist/cassandra/debian 12x main 14 | # install gpg keys 15 | gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D 16 | gpg --export --armor F758CE318D77295D | sudo apt-key add - 17 | gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00 18 | gpg --export --armor 2B5C1B00 | sudo apt-key add - 19 | # update apt 20 | sudo apt-get update 21 | sudo apt-get install cassandra -------------------------------------------------------------------------------- /MULTICAST.md: -------------------------------------------------------------------------------- 1 | http://blogs.agilefaqs.com/2009/11/08/enabling-multicast-on-your-macos-unix/ 2 | 3 | [Fix multicast on virtual machines](http://wcang.blogspot.ca/2011/10/issue-of-multicast-snooping-with-pim.html) 4 | 5 | sudo route -nv add -net 229.9.1.1 -interface vboxnet0 6 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/ActorLifecycleListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import jakarta.annotation.Nullable; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface ActorLifecycleListener { 26 | Class getActorClass(); 27 | 28 | void postCreate(ActorRef actorRef,T actorState); 29 | 30 | void postActivate(ActorRef actorRef,T actorState, @Nullable String previousVersion); 31 | 32 | void prePassivate(ActorRef actorRef,T actorState); 33 | 34 | void preDestroy(ActorRef actorRef,T actorState); 35 | } 36 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/ActorNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public final class ActorNotFoundException extends RuntimeException { 24 | private final ActorRef actorRef; 25 | 26 | public ActorNotFoundException(String message, ActorRef actorRef) { 27 | super(message); 28 | this.actorRef = actorRef; 29 | } 30 | 31 | public ActorRef getActorRef() { 32 | return actorRef; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/Asynchronous.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import java.lang.annotation.*; 21 | 22 | /** 23 | * Use this annotation to annotate methods of {@link ServiceActor} actors to make these methods run on a 24 | * different thread than the actor thread. Should be used when accessing resources such as URLs or Databases 25 | * that don't have an asynchronous API. 26 | * 27 | * @author Joost van de Wijgerd 28 | */ 29 | @Target({ElementType.METHOD}) 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Documented 32 | public @interface Asynchronous { 33 | /** 34 | * Can be used to qualify the executor used, by default set to {@code "asyncExecutor"} 35 | * 36 | * @return the qualifier for the executed to be used, by default set to {@code "asyncExecutor"} 37 | */ 38 | String value() default "asyncExecutor"; 39 | } 40 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/InitialStateProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import jakarta.annotation.Nonnull; 21 | 22 | /** 23 | * Used to provide an actor's initial state for instances managed by the framework. 24 | * Implementations must have a no-args constructor. 25 | */ 26 | public interface InitialStateProvider { 27 | 28 | class Default implements InitialStateProvider { 29 | 30 | @Override 31 | public ActorState getInitialState( 32 | String actorId, 33 | Class stateClass) throws Exception { 34 | return stateClass.newInstance(); 35 | } 36 | } 37 | 38 | @Nonnull 39 | ActorState getInitialState(String actorId, Class stateClass) throws Exception; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/MessageDeliveryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public final class MessageDeliveryException extends RuntimeException { 24 | private final boolean recoverable; 25 | 26 | public MessageDeliveryException(String message,boolean recoverable) { 27 | super(message); 28 | this.recoverable = recoverable; 29 | } 30 | 31 | public MessageDeliveryException(String message, Throwable cause, boolean recoverable) { 32 | super(message, cause); 33 | this.recoverable = recoverable; 34 | } 35 | 36 | public boolean isRecoverable() { 37 | return recoverable; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/PersistentSubscription.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import jakarta.annotation.Nonnull; 21 | import org.reactivestreams.Subscription; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface PersistentSubscription extends Subscription { 27 | @Nonnull 28 | ActorRef getPublisherRef(); 29 | 30 | @Nonnull 31 | String getMessageName(); 32 | 33 | boolean isCancelled(); 34 | } 35 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/PublisherNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public final class PublisherNotFoundException extends RuntimeException { 24 | private final ActorRef publisherRef; 25 | 26 | public PublisherNotFoundException(String message, ActorRef publisherRef) { 27 | super(message); 28 | this.publisherRef = publisherRef; 29 | } 30 | 31 | public ActorRef getPublisherRef() { 32 | return publisherRef; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/ServiceActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import jakarta.inject.Named; 21 | 22 | import java.lang.annotation.*; 23 | 24 | /** 25 | * Marks an actor as a Service Actor (i.e. one singleton instance per Actor Node) 26 | * 27 | * @author Joost van de Wijgerd 28 | */ 29 | @Documented 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.TYPE) 32 | @Named 33 | public @interface ServiceActor { 34 | /** 35 | * 36 | * @return the actorId of the Service Actor 37 | */ 38 | String value() default ""; 39 | } 40 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/SubscriberContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import jakarta.annotation.Nonnull; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface SubscriberContext { 26 | @Nonnull 27 | ActorRef getSelf(); 28 | 29 | @Nonnull 30 | ActorRef getPublisher(); 31 | 32 | @Nonnull 33 | T getState(Class stateClass); 34 | 35 | @Nonnull 36 | ActorSystem getActorSystem(); 37 | 38 | @Nonnull 39 | PersistentSubscription getSubscription(); 40 | } 41 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/TempActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import org.elasticsoftware.elasticactors.state.NullActorState; 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Retention; 25 | import java.lang.annotation.RetentionPolicy; 26 | import java.lang.annotation.Target; 27 | 28 | /** 29 | * Marks an actor as a Temporary Actor (i.e. it's state is not persistent and it won't survive restarts) 30 | * 31 | * @author Joost van de Wijgerd 32 | */ 33 | @Documented 34 | @Retention(RetentionPolicy.RUNTIME) 35 | @Target(ElementType.TYPE) 36 | public @interface TempActor { 37 | /** 38 | * 39 | * @return the class that implements the {@link ActorState} for this Temporary Actor 40 | */ 41 | Class stateClass() default NullActorState.class; 42 | } 43 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/UnexpectedResponseTypeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | public final class UnexpectedResponseTypeException extends RuntimeException { 21 | 22 | public UnexpectedResponseTypeException(String message) { 23 | super(message); 24 | } 25 | 26 | public UnexpectedResponseTypeException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/UntypedActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | 21 | /** 22 | * @author Joost van de Wijgerd 23 | */ 24 | public abstract class UntypedActor extends TypedActor { 25 | } 26 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/UntypedSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public abstract class UntypedSubscriber extends TypedSubscriber { 24 | } 25 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/cluster/ActorRefFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import jakarta.annotation.Nonnull; 21 | import org.elasticsoftware.elasticactors.ActorRef; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface ActorRefFactory { 27 | @Nonnull 28 | ActorRef create(@Nonnull String refSpec); 29 | } 30 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/cluster/ActorSystemEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public enum ActorSystemEvent { 24 | ACTOR_SHARD_INITIALIZED 25 | } 26 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/cluster/scheduler/ScheduledMessageRefFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster.scheduler; 19 | 20 | import jakarta.annotation.Nonnull; 21 | import org.elasticsoftware.elasticactors.scheduler.ScheduledMessageRef; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface ScheduledMessageRefFactory { 27 | @Nonnull ScheduledMessageRef create(@Nonnull String refSpec); 28 | } 29 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.elasticsoftware.elasticactors; 18 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/scheduler/ScheduledMessageRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.scheduler; 19 | 20 | /** 21 | * Reference to a message that has been scheduled to be send in the future via the {@link Scheduler}. 22 | * The reference can be stored an used to cancel the scheduled message 23 | * 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface ScheduledMessageRef { 27 | @SuppressWarnings("unused") 28 | String REFSPEC_FORMAT = "message://%s/%s/shards/%d/%d/%s"; 29 | 30 | void cancel() throws Exception; 31 | 32 | long getFireTime(); 33 | } 34 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/serialization/Deserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization; 19 | 20 | import jakarta.annotation.Nonnull; 21 | import java.io.IOException; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface Deserializer { 27 | @Nonnull 28 | O deserialize(@Nonnull I serializedObject) throws IOException; 29 | 30 | /** 31 | * Whether this deserializer is safe from side effects on the serialized object. 32 | */ 33 | default boolean isSafe() { 34 | return false; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/serialization/MessageDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization; 19 | 20 | import jakarta.annotation.Nonnull; 21 | import java.io.IOException; 22 | import java.nio.ByteBuffer; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public interface MessageDeserializer extends Deserializer { 28 | @Nonnull 29 | @Override 30 | O deserialize(@Nonnull ByteBuffer serializedObject) throws IOException; 31 | 32 | @Nonnull 33 | Class getMessageClass(); 34 | } 35 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/serialization/MessageSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization; 19 | 20 | import jakarta.annotation.Nonnull; 21 | import java.io.IOException; 22 | import java.nio.ByteBuffer; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public interface MessageSerializer extends Serializer { 28 | @Nonnull 29 | @Override 30 | ByteBuffer serialize(@Nonnull I object) throws IOException; 31 | } 32 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/serialization/Serializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization; 19 | 20 | 21 | import java.io.IOException; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface Serializer { 27 | O serialize(I object) throws IOException; 28 | } 29 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/state/ActorLifecycleStep.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.state; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public enum ActorLifecycleStep { 24 | CREATE, 25 | ACTIVATE, 26 | PASSIVATE, 27 | DESTROY 28 | } 29 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/state/NullActorState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.state; 19 | 20 | import org.elasticsoftware.elasticactors.ActorState; 21 | import org.elasticsoftware.elasticactors.serialization.NoopSerializationFramework; 22 | import org.elasticsoftware.elasticactors.serialization.SerializationFramework; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public final class NullActorState implements ActorState { 28 | @Override 29 | public NullActorState getBody() { 30 | return this; 31 | } 32 | 33 | @Override 34 | public Class getSerializationFramework() { 35 | return NoopSerializationFramework.class; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/state/PersistenceAdvisor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.state; 19 | 20 | import jakarta.annotation.Nonnull; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface PersistenceAdvisor { 26 | boolean shouldUpdateState(@Nonnull Object message); 27 | 28 | boolean shouldUpdateState(@Nonnull ActorLifecycleStep lifecycleStep); 29 | } 30 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/tracing/LogContextProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.tracing; 19 | 20 | import jakarta.annotation.Nullable; 21 | import org.elasticsoftware.elasticactors.tracing.MessagingContextManager.MessagingScope; 22 | 23 | public interface LogContextProcessor { 24 | 25 | void process(@Nullable MessagingScope current, @Nullable MessagingScope next); 26 | 27 | boolean isLogContextProcessingEnabled(); 28 | } 29 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/tracing/Traceable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.tracing; 19 | 20 | import jakarta.annotation.Nullable; 21 | 22 | public interface Traceable { 23 | 24 | @Nullable 25 | TraceContext getTraceContext(); 26 | 27 | @Nullable 28 | CreationContext getCreationContext(); 29 | } 30 | -------------------------------------------------------------------------------- /main/api/src/main/java/org/elasticsoftware/elasticactors/tracing/TracedMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.tracing; 19 | 20 | import jakarta.annotation.Nullable; 21 | import org.elasticsoftware.elasticactors.ActorRef; 22 | 23 | public interface TracedMessage extends Traceable { 24 | 25 | @Nullable 26 | ActorRef getSender(); 27 | 28 | String getTypeAsString(); 29 | 30 | @Nullable 31 | Class getType(); 32 | } 33 | -------------------------------------------------------------------------------- /main/api/src/main/uml/actorsystem.uml: -------------------------------------------------------------------------------- 1 | 2 | 3 | JAVA 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | All 12 | 13 | 14 | -------------------------------------------------------------------------------- /main/api/src/main/uml/top-level.uml: -------------------------------------------------------------------------------- 1 | 2 | 3 | JAVA 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | All 12 | 13 | 14 | -------------------------------------------------------------------------------- /main/api/src/test/java/org/elasticsoftware/elasticactors/AnotherTestMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import org.elasticsoftware.elasticactors.serialization.Message; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | @Message(serializationFramework = TestSerializationFramework.class) 26 | public class AnotherTestMessage { 27 | private final String content; 28 | 29 | public AnotherTestMessage(String content) { 30 | this.content = content; 31 | } 32 | 33 | public String getContent() { 34 | return content; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /main/api/src/test/java/org/elasticsoftware/elasticactors/TestActorContextHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public class TestActorContextHolder extends ActorContextHolder { 24 | public static void setContext(ActorContext context) { 25 | threadContext.set(context); 26 | } 27 | 28 | public static void clearContext() { 29 | threadContext.remove(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /main/api/src/test/java/org/elasticsoftware/elasticactors/TestMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import org.elasticsoftware.elasticactors.serialization.Message; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | @Message(serializationFramework = TestSerializationFramework.class) 26 | public class TestMessage { 27 | private final String content; 28 | 29 | public TestMessage(String content) { 30 | this.content = content; 31 | } 32 | 33 | public String getContent() { 34 | return content; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /main/api/src/test/java/org/elasticsoftware/elasticactors/TestMessageHandlers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public class TestMessageHandlers { 24 | @MessageHandler 25 | public void handle(AnotherTestMessage message,ActorRef sender,TestActorState state,ActorSystem actorSystem) { 26 | state.setCallSucceeded(true); 27 | state.setActorSystem(actorSystem); 28 | state.setMessage(message); 29 | state.setSender(sender); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /main/api/src/test/java/org/elasticsoftware/elasticactors/TestPersistentMethodActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | @Actor(stateClass = TestActorState.class,serializationFramework = TestSerializationFramework.class) 24 | @MessageHandlers({TestMessageHandlers.class}) 25 | public class TestPersistentMethodActor extends MethodActor { 26 | 27 | public TestPersistentMethodActor() { 28 | super(); 29 | } 30 | 31 | @MessageHandler 32 | public void handle(TestMessage message,ActorRef sender,TestActorState state,ActorSystem actorSystem) { 33 | state.setCallSucceeded(true); 34 | state.setActorSystem(actorSystem); 35 | state.setMessage(message); 36 | state.setSender(sender); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /main/api/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.showDateTime=true 19 | org.slf4j.simpleLogger.showLogName=false 20 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS -------------------------------------------------------------------------------- /main/base/src/main/java/org/elasticsoftware/elasticactors/base/serialization/JacksonActorRefSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.base.serialization; 19 | 20 | import com.fasterxml.jackson.core.JsonGenerator; 21 | import com.fasterxml.jackson.databind.JsonSerializer; 22 | import com.fasterxml.jackson.databind.SerializerProvider; 23 | import org.elasticsoftware.elasticactors.ActorRef; 24 | 25 | import java.io.IOException; 26 | 27 | /** 28 | * 29 | */ 30 | public final class JacksonActorRefSerializer extends JsonSerializer { 31 | @Override 32 | public void serialize(ActorRef value, JsonGenerator jgen, SerializerProvider provider) throws IOException { 33 | jgen.writeString(value.toString()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /main/base/src/main/java/org/elasticsoftware/elasticactors/base/serialization/JacksonActorStateSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.base.serialization; 19 | 20 | import com.fasterxml.jackson.databind.ObjectMapper; 21 | import org.elasticsoftware.elasticactors.ActorState; 22 | import org.elasticsoftware.elasticactors.serialization.Serializer; 23 | 24 | import java.io.IOException; 25 | 26 | /** 27 | * @author Joost van de Wijgerd 28 | */ 29 | public final class JacksonActorStateSerializer implements Serializer { 30 | private final ObjectMapper objectMapper; 31 | 32 | public JacksonActorStateSerializer(ObjectMapper objectMapper) { 33 | this.objectMapper = objectMapper; 34 | } 35 | 36 | @Override 37 | public byte[] serialize(ActorState object) throws IOException { 38 | return objectMapper.writeValueAsBytes(object); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /main/base/src/main/java/org/elasticsoftware/elasticactors/base/serialization/JacksonMessageSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.base.serialization; 19 | 20 | import com.fasterxml.jackson.databind.ObjectMapper; 21 | import org.elasticsoftware.elasticactors.serialization.MessageSerializer; 22 | 23 | import java.io.IOException; 24 | import java.nio.ByteBuffer; 25 | 26 | /** 27 | * 28 | */ 29 | public final class JacksonMessageSerializer implements MessageSerializer { 30 | private final ObjectMapper objectMapper; 31 | 32 | public JacksonMessageSerializer(ObjectMapper objectMapper) { 33 | this.objectMapper = objectMapper; 34 | } 35 | 36 | @Override 37 | public ByteBuffer serialize(T object) throws IOException { 38 | return ByteBuffer.wrap(objectMapper.writeValueAsBytes(object)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /main/base/src/main/java/org/elasticsoftware/elasticactors/base/serialization/JacksonScheduledMessageRefSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.base.serialization; 19 | 20 | import com.fasterxml.jackson.core.JsonGenerator; 21 | import com.fasterxml.jackson.databind.JsonSerializer; 22 | import com.fasterxml.jackson.databind.SerializerProvider; 23 | import org.elasticsoftware.elasticactors.scheduler.ScheduledMessageRef; 24 | 25 | import java.io.IOException; 26 | 27 | /** 28 | * 29 | */ 30 | public final class JacksonScheduledMessageRefSerializer extends JsonSerializer { 31 | @Override 32 | public void serialize(ScheduledMessageRef value, JsonGenerator jgen, SerializerProvider provider) throws IOException { 33 | jgen.writeString(value.toString()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /main/base/src/main/java/org/elasticsoftware/elasticactors/base/state/AliasActorState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.base.state; 19 | 20 | import com.fasterxml.jackson.annotation.JsonCreator; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import org.elasticsoftware.elasticactors.ActorRef; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public final class AliasActorState extends JacksonActorState { 28 | private final ActorRef aliasedActor; 29 | 30 | @JsonCreator 31 | public AliasActorState(@JsonProperty("aliasedActor") ActorRef aliasedActor) { 32 | this.aliasedActor = aliasedActor; 33 | } 34 | 35 | public ActorRef getAliasedActor() { 36 | return aliasedActor; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /main/base/src/main/java/org/elasticsoftware/elasticactors/base/state/StringState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.base.state; 19 | 20 | import com.fasterxml.jackson.annotation.JsonCreator; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public final class StringState extends JacksonActorState { 27 | private final String stringBody; 28 | 29 | @JsonCreator 30 | public StringState(@JsonProperty("stringBody") String stringBody) { 31 | this.stringBody = stringBody; 32 | } 33 | 34 | @JsonProperty("stringBody") 35 | public String getStringBody() { 36 | return stringBody; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /main/base/src/main/resources/META-INF/elasticactors.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | basePackage=org.elasticsoftware.elasticactors.base -------------------------------------------------------------------------------- /main/base/src/test/java/org/elasticsoftware/elasticactors/TestActorContextHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public class TestActorContextHolder extends ActorContextHolder { 24 | public static void setContext(ActorContext context) { 25 | threadContext.set(context); 26 | } 27 | 28 | public static void clearContext() { 29 | threadContext.remove(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /main/base/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.showDateTime=true 19 | org.slf4j.simpleLogger.showLogName=false 20 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS -------------------------------------------------------------------------------- /main/caching/src/main/resources/META-INF/services/org.elasticsoftware.elasticactors.util.ClassLoadingHelper: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.elasticsoftware.elasticactors.caching.service.CachingClassLoadingHelper -------------------------------------------------------------------------------- /main/client-spring-amqp/src/main/java/org/elasticsoftware/elasticactors/client/spring/SpringAMQPClientConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.client.spring; 19 | 20 | import org.elasticsoftware.elasticactors.client.configuration.ClientConfiguration; 21 | import org.springframework.amqp.core.AmqpAdmin; 22 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 23 | import org.springframework.context.annotation.Bean; 24 | import org.springframework.context.annotation.Import; 25 | 26 | @Import(ClientConfiguration.class) 27 | public class SpringAMQPClientConfiguration { 28 | 29 | @Bean 30 | public RabbitTemplateMessageQueueFactoryFactory rabbitTemplateMessageQueueFactoryFactory( 31 | AmqpAdmin amqpAdmin, 32 | RabbitTemplate rabbitTemplate) { 33 | return new RabbitTemplateMessageQueueFactoryFactory(amqpAdmin, rabbitTemplate); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /main/client/src/main/java/org/elasticsoftware/elasticactors/client/serialization/ActorSystemMessageSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.client.serialization; 19 | 20 | import org.elasticsoftware.elasticactors.client.messaging.ActorSystemMessage; 21 | import org.elasticsoftware.elasticactors.serialization.MessageSerializer; 22 | 23 | import java.io.IOException; 24 | import java.nio.ByteBuffer; 25 | 26 | public final class ActorSystemMessageSerializer implements MessageSerializer { 27 | 28 | private final static ActorSystemMessageSerializer INSTANCE = new ActorSystemMessageSerializer(); 29 | 30 | public static ActorSystemMessageSerializer get() { 31 | return INSTANCE; 32 | } 33 | 34 | @Override 35 | public ByteBuffer serialize(ActorSystemMessage object) throws IOException { 36 | return ByteBuffer.wrap(object.getPayload()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /main/cluster-shoal/src/test/java/org/elasticsoftware/elasticactors/ClusteringTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public class ClusteringTest { 24 | } 25 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/cache/ShardActorCacheManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cache; 19 | 20 | import jakarta.annotation.Nullable; 21 | import org.elasticsoftware.elasticactors.ActorRef; 22 | import org.elasticsoftware.elasticactors.ShardKey; 23 | import org.elasticsoftware.elasticactors.cluster.metrics.MicrometerConfiguration; 24 | import org.elasticsoftware.elasticactors.state.PersistentActor; 25 | 26 | /** 27 | * @author Joost van de Wijgerd 28 | */ 29 | public final class ShardActorCacheManager extends CacheManager> { 30 | public ShardActorCacheManager(int maximumSize, @Nullable 31 | MicrometerConfiguration micrometerConfiguration) { 32 | super(maximumSize, micrometerConfiguration); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/cluster/messaging/ShardReleasedMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster.messaging; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public final class ShardReleasedMessage implements Serializable { 26 | private final String actorSystem; 27 | private final int shardId; 28 | 29 | public ShardReleasedMessage(String actorSystem, int shardId) { 30 | this.actorSystem = actorSystem; 31 | this.shardId = shardId; 32 | } 33 | 34 | public String getActorSystem() { 35 | return actorSystem; 36 | } 37 | 38 | public int getShardId() { 39 | return shardId; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/cluster/metrics/MicrometerTagCustomizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster.metrics; 19 | 20 | import io.micrometer.core.instrument.Tags; 21 | import jakarta.annotation.Nonnull; 22 | 23 | /** 24 | * Type used to customize tags for the various metrics in the Elastic Actors framework 25 | */ 26 | public interface MicrometerTagCustomizer { 27 | 28 | /** 29 | * Provides a set of tags for using with the provided component. 30 | * @param component the name of the component for which to get tags. 31 | * @return the tags for the component. 32 | */ 33 | @Nonnull 34 | Tags get(@Nonnull String component); 35 | } 36 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/cluster/strategies/StartingNodeScaleUpStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster.strategies; 19 | 20 | import org.elasticsoftware.elasticactors.ActorShard; 21 | import org.elasticsoftware.elasticactors.PhysicalNode; 22 | import org.elasticsoftware.elasticactors.cluster.messaging.ShardReleasedMessage; 23 | 24 | import java.util.concurrent.LinkedBlockingQueue; 25 | 26 | /** 27 | * @author Joost van de Wijgerd 28 | */ 29 | public final class StartingNodeScaleUpStrategy extends MultiNodeScaleUpStrategy { 30 | 31 | public StartingNodeScaleUpStrategy(LinkedBlockingQueue shardReleasedMessages) { 32 | super(shardReleasedMessages); 33 | } 34 | 35 | @Override 36 | public void signalRelease(ActorShard localShard, PhysicalNode nextOwner) { 37 | // we don't own any shards on startup 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/cluster/tasks/InternalActorContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster.tasks; 19 | 20 | import org.elasticsoftware.elasticactors.ActorContext; 21 | import org.elasticsoftware.elasticactors.ActorContextHolder; 22 | import org.elasticsoftware.elasticactors.reactivestreams.ProcessorContext; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public final class InternalActorContext extends ActorContextHolder { 28 | 29 | private InternalActorContext() { 30 | super(); 31 | } 32 | 33 | static void setContext(ActorContext context) { 34 | threadContext.set(context); 35 | } 36 | 37 | static void clearContext() { 38 | threadContext.remove(); 39 | } 40 | 41 | public static ProcessorContext getAsProcessorContext() { 42 | return (ProcessorContext) threadContext.get(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/cluster/tasks/reactivestreams/InternalSubscriberContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster.tasks.reactivestreams; 19 | 20 | import org.elasticsoftware.elasticactors.SubscriberContext; 21 | import org.elasticsoftware.elasticactors.SubscriberContextHolder; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public final class InternalSubscriberContext extends SubscriberContextHolder { 27 | private InternalSubscriberContext() { 28 | super(); 29 | } 30 | 31 | static void setContext(SubscriberContext context) { 32 | threadContext.set(context); 33 | } 34 | 35 | static void clearContext() { 36 | threadContext.remove(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/state/ActorStateUpdateProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.state; 19 | 20 | import jakarta.annotation.Nullable; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface ActorStateUpdateProcessor { 26 | void process(@Nullable ActorLifecycleStep lifecycleStep,@Nullable Object message, PersistentActor persistentActor); 27 | } 28 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/state/NoopActorStateUpdateProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.state; 19 | 20 | import jakarta.annotation.Nullable; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public final class NoopActorStateUpdateProcessor implements ActorStateUpdateProcessor { 26 | @Override 27 | public void process(@Nullable ActorLifecycleStep lifecycleStep, @Nullable Object message, PersistentActor persistentActor) { 28 | // do nothing 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/util/ArrayUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.util; 19 | 20 | public final class ArrayUtils { 21 | 22 | private ArrayUtils() { 23 | } 24 | 25 | public static boolean contains(T[] array, T object) { 26 | for (T currentObject : array) { 27 | if (currentObject.equals(object)) { 28 | return true; 29 | } 30 | } 31 | return false; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/util/concurrent/MessageHandlingThreadBoundRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.util.concurrent; 19 | 20 | import org.elasticsoftware.elasticactors.ElasticActor; 21 | import org.elasticsoftware.elasticactors.messaging.InternalMessage; 22 | 23 | public interface MessageHandlingThreadBoundRunnable extends ThreadBoundRunnable { 24 | 25 | Class getActorType(); 26 | 27 | Class getMessageClass(); 28 | 29 | InternalMessage getInternalMessage(); 30 | } 31 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/util/concurrent/ThreadBoundEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.util.concurrent; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface ThreadBoundEvent { 24 | T getKey(); 25 | } 26 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/util/concurrent/ThreadBoundEventProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.util.concurrent; 19 | 20 | import java.util.List; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface ThreadBoundEventProcessor { 26 | void process(List events); 27 | 28 | void process(T event); 29 | } 30 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/util/concurrent/ThreadBoundExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.util.concurrent; 19 | 20 | /** 21 | * ThreadBoundExecutor 22 | * 23 | *

24 | * A thread bound executor guarantees that a runnable executed on the executor that has the same key 25 | * will always be executed by the same thread. 26 | * 27 | * @param The type of the key 28 | * @author Joost van de Wijgerd 29 | */ 30 | public interface ThreadBoundExecutor> { 31 | 32 | void execute(T runnable); 33 | 34 | void shutdown(); 35 | 36 | int getThreadCount(); 37 | 38 | void init(); 39 | } 40 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/util/concurrent/ThreadBoundRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.util.concurrent; 19 | 20 | /** 21 | * 22 | * @param the type of the key 23 | * 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface ThreadBoundRunnable extends Runnable, ThreadBoundEvent { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/util/concurrent/WrapperThreadBoundRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.util.concurrent; 19 | 20 | import jakarta.annotation.Nonnull; 21 | 22 | public interface WrapperThreadBoundRunnable extends ThreadBoundRunnable { 23 | 24 | @Nonnull 25 | ThreadBoundRunnable getWrappedRunnable(); 26 | 27 | @Nonnull 28 | default ThreadBoundRunnable unwrap() { 29 | ThreadBoundRunnable unwrapped = getWrappedRunnable(); 30 | while (unwrapped instanceof WrapperThreadBoundRunnable) { 31 | unwrapped = ((WrapperThreadBoundRunnable) unwrapped).getWrappedRunnable(); 32 | } 33 | return unwrapped; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/util/concurrent/disruptor/ThreadBoundEventWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.util.concurrent.disruptor; 19 | 20 | import org.elasticsoftware.elasticactors.util.concurrent.ThreadBoundEvent; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public final class ThreadBoundEventWrapper { 26 | private ThreadBoundEvent wrappedEvent; 27 | 28 | public ThreadBoundEvent getWrappedEvent() { 29 | return wrappedEvent; 30 | } 31 | 32 | public void setWrappedEvent(ThreadBoundEvent wrappedEvent) { 33 | this.wrappedEvent = wrappedEvent; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /main/core/src/main/java/org/elasticsoftware/elasticactors/util/concurrent/disruptor/ThreadBoundEventWrapperFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.util.concurrent.disruptor; 19 | 20 | import com.lmax.disruptor.EventFactory; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public final class ThreadBoundEventWrapperFactory implements EventFactory { 26 | @Override 27 | public ThreadBoundEventWrapper newInstance() { 28 | return new ThreadBoundEventWrapper(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /main/core/src/main/protobuf/clustering.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package org.elasticsoftware.elasticactors.cluster.protobuf; 4 | 5 | option optimize_for = SPEED; 6 | 7 | // WARNING: 8 | // you must not change the tag numbers of any existing fields. 9 | // you must not add or delete any required fields. 10 | // you may delete optional or repeated fields. 11 | // you may add new optional or repeated fields but you must use fresh tag numbers (i.e. tag numbers that were never 12 | // used in this protocol buffer, not even by deleted fields). 13 | 14 | message ClusterMessage { 15 | optional ShardReleased shardReleased = 1; 16 | optional int64 viewId = 2; 17 | } 18 | 19 | message ShardReleased { 20 | optional int32 shardId = 1; 21 | optional string actorSystem = 2; 22 | } -------------------------------------------------------------------------------- /main/core/src/main/protobuf/elasticactors.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package org.elasticsoftware.elasticactors.serialization.protobuf; 4 | 5 | 6 | option optimize_for = SPEED; 7 | 8 | // WARNING: 9 | // you must not change the tag numbers of any existing fields. 10 | // you must not add or delete any required fields. 11 | // you may delete optional or repeated fields. 12 | // you may add new optional or repeated fields but you must use fresh tag numbers (i.e. tag numbers that were never 13 | // used in this protocol buffer, not even by deleted fields). 14 | 15 | message ActorSystemEventListener { 16 | optional string actorId = 1; 17 | optional string messageClass = 2; 18 | optional bytes message = 3; 19 | optional string messageQueueAffinityKey = 4; 20 | } 21 | 22 | message PersistentActor { 23 | optional string actorRef = 1; 24 | optional string actorClass = 2; 25 | optional string actorSystemVersion = 3; 26 | optional bytes state = 4; 27 | optional string shardKey = 5; 28 | repeated Subscriber subscribers = 6; 29 | repeated Subscription subscriptions = 7; 30 | } 31 | 32 | message Subscriber { 33 | optional string subscriberRef = 1; 34 | optional string messageName = 2; 35 | optional uint64 leases = 3; 36 | } 37 | 38 | message Subscription { 39 | optional string publisherRef = 1; 40 | optional string messageName = 2; 41 | optional bool cancelled = 3; 42 | } -------------------------------------------------------------------------------- /main/core/src/main/resources/META-INF/elasticactors.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | basePackage=org.elasticsoftware.elasticactors.core -------------------------------------------------------------------------------- /main/core/src/test/java/org/elasticsoftware/elasticactors/serialization/SerializationContextTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization; 19 | 20 | import org.testng.annotations.Test; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public class SerializationContextTest { 26 | @Test 27 | public void testDeserializationCaching() { 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /main/core/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.showDateTime=true 19 | org.slf4j.simpleLogger.showLogName=false 20 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/config/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kafkatest 3 | shards: 32 -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/config/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.logFile=System.out 19 | org.slf4j.simpleLogger.defaultLogLevel=error 20 | org.slf4j.simpleLogger.log.org.elasticsoftware.elasticactors.kafka=info 21 | org.slf4j.simpleLogger.log.org.elasticsoftware.elasticactors=error 22 | org.slf4j.simpleLogger.log.com.getbux.containers=info 23 | org.slf4j.simpleLogger.log.org.springframework=info 24 | org.slf4j.simpleLogger.showDateTime=true 25 | org.slf4j.simpleLogger.showLogName=false -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/config/system.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | jwt.sharedSecret=7bc13c0080ee11e3baa70800200c9a66 19 | jwt.audience=local.getbux.com 20 | #ea.node.port=9090 21 | ea.node.config.location=classpath:config.yaml 22 | ea.cluster=kafkatest.local.getbux.com 23 | ea.cluster.discovery.nodes=tcp://localhost:9090,tcp://localhost:9091,tcp://localhost:9092 24 | ea.nodeCache.maximumSize=1024 25 | ea.shardCache.maximumSize=10240 26 | ea.actorRefCache.maximumSize=10240 27 | ea.shardThreads.workerCount=1 28 | ea.persistentActorRepository.compressionThreshold=2048 29 | ea.base.useAfterburner=true 30 | ea.kafka.bootstrapServers=192.168.99.100:32400,192.168.99.100:32401,192.168.99.100:32402 31 | #ea.kafka.persistentActorStore.factoryClass=ChronicleMapPersistentActorStoreFactory -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/main/java/org/elasticsoftware/elasticactors/kafka/testapp/messages/ActivateAccountCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.testapp.messages; 19 | 20 | import org.elasticsoftware.elasticactors.base.serialization.JacksonSerializationFramework; 21 | import org.elasticsoftware.elasticactors.serialization.Message; 22 | 23 | @Message(serializationFramework = JacksonSerializationFramework.class, immutable = true) 24 | public class ActivateAccountCommand { 25 | } 26 | -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/main/java/org/elasticsoftware/elasticactors/kafka/testapp/messages/BalanceQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.testapp.messages; 19 | 20 | import org.elasticsoftware.elasticactors.base.serialization.JacksonSerializationFramework; 21 | import org.elasticsoftware.elasticactors.serialization.Message; 22 | 23 | @Message(serializationFramework = JacksonSerializationFramework.class, immutable = true) 24 | public class BalanceQuery { 25 | } 26 | -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/main/java/org/elasticsoftware/elasticactors/kafka/testapp/messages/CreditAccountEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.testapp.messages; 19 | 20 | import com.fasterxml.jackson.annotation.JsonCreator; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import org.elasticsoftware.elasticactors.base.serialization.JacksonSerializationFramework; 23 | import org.elasticsoftware.elasticactors.serialization.Message; 24 | 25 | import java.math.BigDecimal; 26 | 27 | @Message(serializationFramework = JacksonSerializationFramework.class, immutable = true) 28 | public class CreditAccountEvent { 29 | private final BigDecimal amount; 30 | 31 | @JsonCreator 32 | public CreditAccountEvent(@JsonProperty("amount") BigDecimal amount) { 33 | this.amount = amount; 34 | } 35 | 36 | public BigDecimal getAmount() { 37 | return amount; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/main/java/org/elasticsoftware/elasticactors/kafka/testapp/messages/DebitAccountEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.testapp.messages; 19 | 20 | import com.fasterxml.jackson.annotation.JsonCreator; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import org.elasticsoftware.elasticactors.base.serialization.JacksonSerializationFramework; 23 | import org.elasticsoftware.elasticactors.serialization.Message; 24 | 25 | import java.math.BigDecimal; 26 | 27 | @Message(serializationFramework = JacksonSerializationFramework.class, immutable = true) 28 | public class DebitAccountEvent { 29 | private final BigDecimal amount; 30 | 31 | @JsonCreator 32 | public DebitAccountEvent(@JsonProperty("amount") BigDecimal amount) { 33 | this.amount = amount; 34 | } 35 | 36 | public BigDecimal getAmount() { 37 | return amount; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/main/java/org/elasticsoftware/elasticactors/kafka/testapp/messages/ScheduleDebitCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.testapp.messages; 19 | 20 | import com.fasterxml.jackson.annotation.JsonCreator; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import org.elasticsoftware.elasticactors.base.serialization.JacksonSerializationFramework; 23 | import org.elasticsoftware.elasticactors.serialization.Message; 24 | 25 | @Message(serializationFramework = JacksonSerializationFramework.class, immutable = true) 26 | public class ScheduleDebitCommand { 27 | private final DebitAccountEvent message; 28 | 29 | @JsonCreator 30 | public ScheduleDebitCommand(@JsonProperty("message") DebitAccountEvent message) { 31 | this.message = message; 32 | } 33 | 34 | public DebitAccountEvent getMessage() { 35 | return message; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/main/resources/META-INF/elasticactors.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | basePackage=org.elasticsoftware.elasticactors.kafka.testapp 19 | -------------------------------------------------------------------------------- /main/elasticactors-kafka-testapp/src/main/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.showDateTime=true 19 | org.slf4j.simpleLogger.showLogName=false 20 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/main/java/org/elasticsoftware/elasticactors/kafka/InternalActorContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka; 19 | 20 | import org.elasticsoftware.elasticactors.ActorContext; 21 | import org.elasticsoftware.elasticactors.ActorContextHolder; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | final class InternalActorContext extends ActorContextHolder { 27 | 28 | private InternalActorContext() { 29 | super(); 30 | } 31 | 32 | static void setContext(ActorContext context) { 33 | threadContext.set(context); 34 | } 35 | 36 | static void clearContext() { 37 | threadContext.remove(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/main/java/org/elasticsoftware/elasticactors/kafka/KafkaTransactionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka; 19 | 20 | import org.apache.kafka.clients.producer.KafkaProducer; 21 | 22 | public final class KafkaTransactionContext { 23 | private static final ThreadLocal> transactionalProducer = new ThreadLocal<>(); 24 | 25 | static void setTransactionalProducer(KafkaProducer producer) { 26 | transactionalProducer.set(producer); 27 | } 28 | 29 | static KafkaProducer getProducer() { 30 | return transactionalProducer.get(); 31 | } 32 | 33 | static void clear() { 34 | transactionalProducer.remove(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/main/java/org/elasticsoftware/elasticactors/kafka/ManagedActorContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka; 19 | 20 | import com.google.common.cache.Cache; 21 | import org.elasticsoftware.elasticactors.ActorRef; 22 | import org.elasticsoftware.elasticactors.state.PersistentActor; 23 | 24 | public interface ManagedActorContainer { 25 | PersistentActor getPersistentActor(ActorRef actorRef); 26 | 27 | void persistActor(PersistentActor persistentActor); 28 | 29 | void deleteActor(PersistentActor persistentActor); 30 | 31 | boolean containsKey(ActorRef actorRef); 32 | 33 | K getKey(); 34 | 35 | Cache> getActorCache(); 36 | } 37 | -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/main/java/org/elasticsoftware/elasticactors/kafka/cluster/ActorLifecycleFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.cluster; 19 | 20 | 21 | import org.elasticsoftware.elasticactors.ActorRef; 22 | import org.elasticsoftware.elasticactors.ElasticActor; 23 | import org.elasticsoftware.elasticactors.cluster.InternalActorSystem; 24 | import org.elasticsoftware.elasticactors.messaging.InternalMessage; 25 | import org.elasticsoftware.elasticactors.state.PersistentActor; 26 | 27 | @FunctionalInterface 28 | public interface ActorLifecycleFunction { 29 | Boolean apply(InternalActorSystem actorSystem, PersistentActor persistentActor, ElasticActor receiver, ActorRef receiverRef, InternalMessage internalMessage); 30 | } 31 | -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/main/java/org/elasticsoftware/elasticactors/kafka/cluster/InternalSubscriberContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.SubscriberContext; 21 | import org.elasticsoftware.elasticactors.SubscriberContextHolder; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | final class InternalSubscriberContext extends SubscriberContextHolder { 27 | private InternalSubscriberContext() { 28 | super(); 29 | } 30 | 31 | static void setContext(SubscriberContext context) { 32 | threadContext.set(context); 33 | } 34 | 35 | static void clearContext() { 36 | threadContext.remove(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/main/java/org/elasticsoftware/elasticactors/kafka/serialization/UUIDDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.serialization; 19 | 20 | import org.apache.kafka.common.serialization.Deserializer; 21 | import org.elasticsoftware.elasticactors.messaging.UUIDTools; 22 | 23 | import java.util.Map; 24 | import java.util.UUID; 25 | 26 | public final class UUIDDeserializer implements Deserializer { 27 | @Override 28 | public void configure(Map configs, boolean isKey) { 29 | 30 | } 31 | 32 | @Override 33 | public UUID deserialize(String topic, byte[] data) { 34 | if(data == null) { 35 | return null; 36 | } else { 37 | return UUIDTools.fromByteArray(data); 38 | } 39 | } 40 | 41 | @Override 42 | public void close() { 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/main/java/org/elasticsoftware/elasticactors/kafka/serialization/UUIDSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.serialization; 19 | 20 | import org.apache.kafka.common.serialization.Serializer; 21 | import org.elasticsoftware.elasticactors.messaging.UUIDTools; 22 | 23 | import java.util.Map; 24 | import java.util.UUID; 25 | 26 | public final class UUIDSerializer implements Serializer { 27 | @Override 28 | public void configure(Map configs, boolean isKey) { 29 | 30 | } 31 | 32 | @Override 33 | public byte[] serialize(String topic, UUID uuid) { 34 | if (uuid == null) { 35 | return null; 36 | } else { 37 | return UUIDTools.toByteArray(uuid); 38 | } 39 | } 40 | 41 | @Override 42 | public void close() { 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/main/java/org/elasticsoftware/elasticactors/kafka/state/InMemoryPeristentActorStoreFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.state; 19 | 20 | import org.elasticsoftware.elasticactors.ShardKey; 21 | import org.elasticsoftware.elasticactors.serialization.Deserializer; 22 | import org.elasticsoftware.elasticactors.state.PersistentActor; 23 | 24 | public final class InMemoryPeristentActorStoreFactory implements PersistentActorStoreFactory { 25 | @Override 26 | public PersistentActorStore create(ShardKey shardKey, Deserializer> deserializer) { 27 | return new InMemoryPersistentActorStore(shardKey, deserializer); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/main/java/org/elasticsoftware/elasticactors/kafka/state/PersistentActorStoreFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.kafka.state; 19 | 20 | import org.elasticsoftware.elasticactors.ShardKey; 21 | import org.elasticsoftware.elasticactors.serialization.Deserializer; 22 | import org.elasticsoftware.elasticactors.state.PersistentActor; 23 | 24 | public interface PersistentActorStoreFactory { 25 | PersistentActorStore create(ShardKey shardKey, Deserializer> deserializer); 26 | } 27 | -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/test/resources/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kafkatest 3 | shards: 32 -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.showDateTime=true 19 | org.slf4j.simpleLogger.showLogName=false 20 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS -------------------------------------------------------------------------------- /main/elasticactors-kafka/src/test/resources/system.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | jwt.sharedSecret=7bc13c0080ee11e3baa70800200c9a66 19 | jwt.audience=local.getbux.com 20 | ea.node.port=9090 21 | ea.node.config.location=classpath:config.yaml 22 | ea.cluster=kafkatest.local.getbux.com 23 | ea.cluster.discovery.nodes=tcp:// 24 | ea.nodeCache.maximumSize=1024 25 | ea.shardCache.maximumSize=10240 26 | ea.actorRefCache.maximumSize=10240 27 | ea.shardThreads.workerCount=4 28 | ea.persistentActorRepository.compressionThreshold=2048 29 | ea.base.useAfterburner=true 30 | ea.kafka.bootstrapServers=api.local.getbux.com:32400,api.local.getbux.com:32401,api.local.getbux.com:32402 -------------------------------------------------------------------------------- /main/indexing-elasticsearch/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.showDateTime=true 19 | org.slf4j.simpleLogger.showLogName=false 20 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS -------------------------------------------------------------------------------- /main/messaging-rabbitmq/src/main/java/org/elasticsoftware/elasticactors/rabbitmq/ChannelListenerRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.rabbitmq; 19 | 20 | import com.rabbitmq.client.Channel; 21 | import net.jodah.lyra.event.ChannelListener; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface ChannelListenerRegistry { 27 | void addChannelListener(Channel channel,ChannelListener channelListener); 28 | 29 | void removeChannelListener(Channel channel, ChannelListener channelListener); 30 | } 31 | -------------------------------------------------------------------------------- /main/messaging-rabbitmq/src/main/java/org/elasticsoftware/elasticactors/rabbitmq/LoggingShutdownListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.rabbitmq; 19 | 20 | import com.rabbitmq.client.ShutdownListener; 21 | import com.rabbitmq.client.ShutdownSignalException; 22 | import org.slf4j.Logger; 23 | import org.slf4j.LoggerFactory; 24 | 25 | public final class LoggingShutdownListener implements ShutdownListener { 26 | 27 | private LoggingShutdownListener() { 28 | } 29 | 30 | public final static LoggingShutdownListener INSTANCE = new LoggingShutdownListener(); 31 | 32 | private final static Logger logger = LoggerFactory.getLogger(LoggingShutdownListener.class); 33 | 34 | @Override 35 | public void shutdownCompleted(ShutdownSignalException e) { 36 | if (!e.isInitiatedByApplication()) { 37 | logger.error("Channel shutdown detected", e); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /main/messaging-rabbitmq/src/main/java/org/elasticsoftware/elasticactors/rabbitmq/MessageAcker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.rabbitmq; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface MessageAcker { 24 | void deliver(long deliveryTag); 25 | 26 | void ack(long deliveryTag); 27 | 28 | void start(); 29 | 30 | void stop(); 31 | 32 | public enum Type { 33 | DIRECT,BUFFERED,WRITE_BEHIND,ASYNC 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /main/messaging-rabbitmq/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.showDateTime=true 19 | org.slf4j.simpleLogger.showLogName=false 20 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS 21 | org.slf4j.simpleLogger.log.org.elasticsoftware.elasticactors.rabbitmq.ack.BufferingMessageAcker=debug -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/messaging/MessageQueueProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | public interface MessageQueueProxy { 21 | 22 | void init() throws Exception; 23 | 24 | void destroy(); 25 | 26 | void offerInternalMessage(InternalMessage message); 27 | } 28 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/messaging/Splittable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | import com.google.common.collect.ImmutableMap; 21 | 22 | public interface Splittable { 23 | 24 | ImmutableMap splitInBuckets(Hasher hasher, int buckets); 25 | } 26 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/messaging/internal/ActorType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging.internal; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public enum ActorType { 24 | PERSISTENT, 25 | TEMP, 26 | SERVICE 27 | } 28 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/messaging/internal/InternalHashKeyUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging.internal; 19 | 20 | import jakarta.annotation.Nullable; 21 | 22 | public final class InternalHashKeyUtils { 23 | 24 | private InternalHashKeyUtils() { 25 | } 26 | 27 | /** 28 | * Return the key of an object if it implements {@link MessageQueueBoundPayload}. 29 | */ 30 | @Nullable 31 | public static String getMessageQueueAffinityKey(@Nullable Object object) { 32 | if (object instanceof MessageQueueBoundPayload) { 33 | String key = ((MessageQueueBoundPayload) object).getMessageQueueAffinityKey(); 34 | if (key != null && !key.isEmpty()) { 35 | return key; 36 | } 37 | } 38 | return null; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/messaging/internal/MessageQueueBoundPayload.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging.internal; 19 | 20 | import jakarta.annotation.Nullable; 21 | 22 | /** 23 | * This interface is used to allow messages sent to a container to still be hashed to 24 | * the same queue as the messages to specific actors, when using multiple queues per container. 25 | * 26 | * e.g. a CreateActorMessage message has to go to the same broker and/or in-memory queue as the 27 | * messages that are to be sent to the actor that was created, so it can be processed first. 28 | */ 29 | interface MessageQueueBoundPayload { 30 | 31 | @Nullable 32 | String getMessageQueueAffinityKey(); 33 | } 34 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/messaging/reactivestreams/CompletedMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging.reactivestreams; 19 | 20 | import org.elasticsoftware.elasticactors.serialization.Message; 21 | import org.elasticsoftware.elasticactors.serialization.SystemSerializationFramework; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | @Message(immutable = true, durable = false, serializationFramework = SystemSerializationFramework.class) 27 | public final class CompletedMessage implements ReactiveStreamsProtocol { 28 | private final String messageName; 29 | 30 | public CompletedMessage(String messageName) { 31 | this.messageName = messageName; 32 | } 33 | 34 | public String getMessageName() { 35 | return messageName; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/messaging/reactivestreams/ReactiveStreamsProtocol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging.reactivestreams; 19 | 20 | import jakarta.annotation.Nonnull; 21 | 22 | /** 23 | * Tagging interface to signal that the message is part of the Reactive Streams protocol 24 | * 25 | * @author Joost van de Wijgerd 26 | */ 27 | public interface ReactiveStreamsProtocol { 28 | static boolean isReactive(@Nonnull String className) { 29 | return className.startsWith("org.elasticsoftware.elasticactors.messaging.reactivestreams"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/messaging/reactivestreams/SubscriptionMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging.reactivestreams; 19 | 20 | import org.elasticsoftware.elasticactors.serialization.Message; 21 | import org.elasticsoftware.elasticactors.serialization.SystemSerializationFramework; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | @Message(immutable = true, durable = false, serializationFramework = SystemSerializationFramework.class) 27 | public final class SubscriptionMessage implements ReactiveStreamsProtocol { 28 | private final String messageName; 29 | 30 | public SubscriptionMessage(String messageName) { 31 | this.messageName = messageName; 32 | } 33 | 34 | public String getMessageName() { 35 | return messageName; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/serialization/SystemDeserializers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization; 19 | 20 | public interface SystemDeserializers { 21 | 22 | MessageDeserializer get(Class messageClass); 23 | } 24 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/serialization/SystemSerializers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization; 19 | 20 | public interface SystemSerializers { 21 | 22 | MessageSerializer get(Class messageClass); 23 | } 24 | -------------------------------------------------------------------------------- /main/messaging/src/main/java/org/elasticsoftware/elasticactors/serialization/internal/ActorRefSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization.internal; 19 | 20 | import org.elasticsoftware.elasticactors.ActorRef; 21 | import org.elasticsoftware.elasticactors.serialization.Serializer; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public final class ActorRefSerializer implements Serializer { 27 | private static final ActorRefSerializer INSTANCE = new ActorRefSerializer(); 28 | 29 | public static ActorRefSerializer get() { 30 | return INSTANCE; 31 | } 32 | 33 | @Override 34 | public String serialize(ActorRef actorRef) { 35 | return actorRef.toString(); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /main/messaging/src/main/protobuf/reactivestreams.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package org.elasticsoftware.elasticactors.serialization.protobuf; 4 | 5 | 6 | option optimize_for = SPEED; 7 | 8 | message SubscribeMessage { 9 | optional string subscriberRef = 1; 10 | optional string messageName = 2; 11 | } 12 | 13 | message SubscriptionMessage { 14 | optional string messageName = 1; 15 | } 16 | 17 | message CancelMessage { 18 | optional string subscriberRef = 1; 19 | optional string messageName = 2; 20 | } 21 | 22 | message CompletedMessage { 23 | optional string messageName = 1; 24 | } 25 | 26 | message NextMessage { 27 | optional string messageName = 1; 28 | optional bytes messageBytes = 2; 29 | } 30 | 31 | message RequestMessage { 32 | optional string messageName = 1; 33 | optional uint64 n = 2; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /main/runtime/src/main/java/org/elasticsoftware/elasticactors/cluster/HashingNodeSelectorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.PhysicalNode; 21 | import org.elasticsoftware.elasticactors.messaging.Hasher; 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * @author Joost van de Wijgerd 27 | */ 28 | public final class HashingNodeSelectorFactory implements NodeSelectorFactory { 29 | @Override 30 | public NodeSelector create(Hasher hasher, List nodes) { 31 | return new HashingNodeSelector(hasher, nodes); 32 | } 33 | 34 | @Override 35 | public void start() throws Exception { 36 | // nothing to do 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /main/runtime/src/main/java/org/elasticsoftware/elasticactors/spring/ActorAnnotationBeanNameGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.spring; 19 | 20 | import org.springframework.context.annotation.AnnotationBeanNameGenerator; 21 | 22 | import java.util.Map; 23 | import java.util.Set; 24 | 25 | /** 26 | * @author Joost van de Wijgerd 27 | */ 28 | public class ActorAnnotationBeanNameGenerator extends AnnotationBeanNameGenerator { 29 | @Override 30 | protected boolean isStereotypeWithNameValue(String annotationType, Set metaAnnotationTypes, Map attributes) { 31 | if(annotationType.equals("org.elasticsoftware.elasticactors.ServiceActor")) { 32 | return true; 33 | } else { 34 | return super.isStereotypeWithNameValue(annotationType,metaAnnotationTypes,attributes); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/runtime/src/main/resources/ea-default.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: default 3 | shards: 8 4 | remoteActorSystems: 5 | - clusterName: test2.elasticsoftware.org 6 | name: default 7 | shards: 8 8 | - clusterName: test3.elasticsoftware.org 9 | name: default 10 | shards: 8 11 | elasticactors.http.actors.HttpService: 12 | listenPort: 8080 13 | 14 | -------------------------------------------------------------------------------- /main/runtime/src/test/java/org/elasticsoftware/elasticactors/test/TestActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test; 19 | 20 | import org.elasticsoftware.elasticactors.Actor; 21 | import org.elasticsoftware.elasticactors.ActorRef; 22 | import org.elasticsoftware.elasticactors.UntypedActor; 23 | import org.slf4j.Logger; 24 | import org.slf4j.LoggerFactory; 25 | 26 | /** 27 | * @author Joost van de Wijgerd 28 | */ 29 | @Actor 30 | public final class TestActor extends UntypedActor { 31 | 32 | private final static Logger staticLogger = LoggerFactory.getLogger(TestActor.class); 33 | 34 | @Override 35 | protected Logger initLogger() { 36 | return staticLogger; 37 | } 38 | 39 | @Override 40 | public void onReceive(ActorRef sender, Object message) throws Exception { 41 | //To change body of implemented methods use File | Settings | File Templates. 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /main/runtime/src/test/resources/ea-test.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: default 3 | shards: 8 4 | remoteActorSystems: 5 | - clusterName: test2.elasticsoftware.org 6 | name: default 7 | shards: 8 8 | - clusterName: test3.elasticsoftware.org 9 | name: default 10 | shards: 8 11 | elasticactors.http.actors.HttpService: 12 | listenPort: 8080 13 | elasticactors.test.TestActor: 14 | pushConfigurations: 15 | - clientId: 123282 16 | keystoreResource: classpath:test_1.p12 17 | keystorePassword: bladiebla 18 | - clientId: 193382 19 | keystoreResource: classpath:test_1.p12 20 | keystorePassword: bladiebla 21 | org.elasticsoftware.elasticactors.test.TestActorFullName: 22 | pushConfigurations: 23 | - clientId: 123282 24 | keystoreResource: classpath:test_1.p12 25 | keystorePassword: bladiebla 26 | - clientId: 193382 27 | keystoreResource: classpath:test_1.p12 28 | keystorePassword: bladiebla 29 | -------------------------------------------------------------------------------- /main/runtime/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.showDateTime=true 19 | org.slf4j.simpleLogger.showLogName=false 20 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/ActorContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import org.elasticsoftware.elasticactors.messaging.InternalMessage; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public interface ActorContainer { 28 | ActorRef getActorRef(); 29 | 30 | void sendMessage(ActorRef sender, ActorRef receiver, Object message) throws Exception; 31 | 32 | void sendMessage(ActorRef sender, List receiver, Object message) throws Exception; 33 | 34 | void undeliverableMessage(InternalMessage undeliverableMessage, ActorRef receiverRef) throws Exception; 35 | 36 | void offerInternalMessage(InternalMessage message); 37 | 38 | void init() throws Exception; 39 | 40 | void destroy(); 41 | } 42 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/ActorContainerRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface ActorContainerRef { 24 | ActorContainer getActorContainer(); 25 | } 26 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/ActorLifecycleListenerRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import java.util.List; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface ActorLifecycleListenerRegistry { 26 | void init(); 27 | List> getListeners(Class actorClass); 28 | } 29 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/ActorNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface ActorNode extends ActorContainer { 24 | NodeKey getKey(); 25 | 26 | boolean isLocal(); 27 | } 28 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/ActorShard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface ActorShard extends ActorContainer { 24 | ShardKey getKey(); 25 | 26 | PhysicalNode getOwningNode(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/InternalActorSystemConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | import java.util.List; 21 | import java.util.Set; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface InternalActorSystemConfiguration extends ActorSystemConfiguration { 27 | 28 | /** 29 | * Return the singleton service instance 30 | * 31 | * @param serviceId 32 | * @return 33 | */ 34 | ElasticActor getService(String serviceId); 35 | 36 | /** 37 | * return a list of service actor id's 38 | * 39 | * @return 40 | */ 41 | Set getServices(); 42 | 43 | /** 44 | * Return the remote configurations 45 | * 46 | * @return 47 | */ 48 | List getRemoteConfigurations(); 49 | } 50 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/RemoteActorSystemConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface RemoteActorSystemConfiguration { 24 | String getName(); 25 | 26 | int getNumberOfShards(); 27 | 28 | int getQueuesPerShard(); 29 | 30 | String getClusterName(); 31 | 32 | int getShardHashSeed(); 33 | 34 | int getMultiQueueHashSeed(); 35 | } 36 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cache/EvictionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cache; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface EvictionListener { 24 | void onEvicted(V value); 25 | } 26 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/ActorSystemEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import jakarta.annotation.Nullable; 21 | 22 | import java.nio.ByteBuffer; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public interface ActorSystemEventListener { 28 | String getActorId(); 29 | 30 | Class getMessageClass(); 31 | 32 | ByteBuffer getMessageBytes(); 33 | 34 | @Nullable 35 | String getMessageQueueAffinityKey(); 36 | } 37 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/ActorSystemEventListenerRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.ActorRef; 21 | import org.elasticsoftware.elasticactors.ShardKey; 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * @author Joost van de Wijgerd 27 | */ 28 | public interface ActorSystemEventListenerRepository { 29 | void create(ShardKey shardKey, ActorSystemEvent event, ActorSystemEventListener listener); 30 | 31 | void delete(ShardKey shardKey, ActorSystemEvent event, ActorRef listenerId); 32 | 33 | List getAll(ShardKey shardKey, ActorSystemEvent event); 34 | } 35 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/ActorSystemEventListenerService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface ActorSystemEventListenerService extends ActorSystemEventListenerRegistry,InternalActorSystemEventListenerRegistry { 24 | } 25 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/ClusterEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.PhysicalNode; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public interface ClusterEventListener { 28 | void onTopologyChanged(List topology) throws Exception; 29 | 30 | default void onMasterElected(PhysicalNode masterNode) throws Exception { 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/ClusterMessageHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface ClusterMessageHandler { 24 | /** 25 | * Handle a message from the Clustering subsystem. These are messages that can be send by the members to each other. 26 | * 27 | * @param message the message bytes 28 | * @param senderToken the id (token) of the sending member 29 | */ 30 | public void handleMessage(byte[] message,String senderToken); 31 | } 32 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/ClusterService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface ClusterService { 24 | void reportReady() throws Exception; 25 | 26 | void reportPlannedShutdown(); 27 | 28 | void addEventListener(ClusterEventListener eventListener); 29 | 30 | void removeEventListener(ClusterEventListener eventListener); 31 | 32 | void sendMessage(String memberToken, byte[] message) throws Exception; 33 | 34 | void setClusterMessageHandler(ClusterMessageHandler clusterMessageHandler); 35 | } 36 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/InternalActorSystemEventListenerRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.ActorShard; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface InternalActorSystemEventListenerRegistry { 26 | void generateEvents(ActorShard actorShard,ActorSystemEvent actorSystemEvent); 27 | } 28 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/InternalActorSystems.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.*; 21 | import org.elasticsoftware.elasticactors.serialization.SerializationFrameworks; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface InternalActorSystems extends ActorSystems, SerializationFrameworks { 27 | @Override 28 | InternalActorSystem get(String name); 29 | 30 | ActorRef createPersistentActorRef(ActorShard shard, String actorId); 31 | 32 | ActorRef createTempActorRef(ActorNode node, String actorId); 33 | 34 | ActorRef createServiceActorRef(ActorNode node, String actorId); 35 | 36 | String getActorStateVersion(Class actorClass); 37 | } 38 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/NodeSelector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.PhysicalNode; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public interface NodeSelector { 28 | List getAll(); 29 | 30 | PhysicalNode getPrimary(String shardKey); 31 | } 32 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/NodeSelectorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.PhysicalNode; 21 | import org.elasticsoftware.elasticactors.messaging.Hasher; 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * @author Joost van de Wijgerd 27 | */ 28 | public interface NodeSelectorFactory { 29 | 30 | NodeSelector create(Hasher hasher, List nodes); 31 | 32 | void start() throws Exception; 33 | } 34 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/ShardAccessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.ActorShard; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface ShardAccessor { 26 | /** 27 | * Return the {@link org.elasticsoftware.elasticactors.ActorShard} that belongs to the given path. 28 | * 29 | * @param actorPath 30 | * @return 31 | */ 32 | ActorShard getShard(String actorPath); 33 | 34 | /** 35 | * Return an ActorShard with the given shardId 36 | * 37 | * @param shardId 38 | * @return 39 | */ 40 | ActorShard getShard(int shardId); 41 | 42 | int getNumberOfShards(); 43 | } 44 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/ShardDistributor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.PhysicalNode; 21 | 22 | import java.util.List; 23 | 24 | public interface ShardDistributor { 25 | void updateNodes(List nodes) throws Exception; 26 | 27 | void distributeShards(List nodes, ShardDistributionStrategy strategy) throws Exception; 28 | } 29 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/scheduler/InternalScheduler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster.scheduler; 19 | 20 | import org.elasticsoftware.elasticactors.ShardKey; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface InternalScheduler { 26 | public void cancel(ShardKey shardKey,ScheduledMessageKey messageKey); 27 | } 28 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/cluster/scheduler/ScheduledMessageRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.cluster.scheduler; 19 | 20 | import org.elasticsoftware.elasticactors.ShardKey; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public interface ScheduledMessageRepository { 28 | void create(ShardKey shardKey, ScheduledMessage scheduledMessage); 29 | 30 | void delete(ShardKey shardKey, ScheduledMessageKey scheduledMessage); 31 | 32 | List getAll(ShardKey shardKey); 33 | } 34 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/health/HealthCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.health; 19 | 20 | /** 21 | * @author Rob de Boer 22 | */ 23 | public interface HealthCheck { 24 | 25 | HealthCheckResult check(); 26 | } 27 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/messaging/Hasher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | public interface Hasher { 21 | 22 | int hashStringToInt(String value); 23 | 24 | long hashStringToLong(String value); 25 | } 26 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/messaging/MessageHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | import org.elasticsoftware.elasticactors.PhysicalNode; 21 | 22 | /** 23 | * @author Joost van de Wijgerd 24 | */ 25 | public interface MessageHandler { 26 | PhysicalNode getPhysicalNode(); 27 | 28 | void handleMessage(InternalMessage message,MessageHandlerEventListener messageHandlerEventListener); 29 | } 30 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/messaging/MessageHandlerEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface MessageHandlerEventListener { 24 | void onError(InternalMessage message,Throwable exception); 25 | 26 | void onDone(InternalMessage message); 27 | } 28 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/messaging/MessageQueue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface MessageQueue { 24 | boolean offer(InternalMessage message); 25 | 26 | boolean add(InternalMessage message); 27 | 28 | InternalMessage poll(); 29 | 30 | String getName(); 31 | 32 | void initialize() throws Exception; 33 | 34 | void destroy(); 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/messaging/MessageQueueEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface MessageQueueEventListener { 24 | void wakeUp(); 25 | 26 | void onDestroy(MessageQueue queue); 27 | } 28 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/messaging/MessageQueueFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface MessageQueueFactory { 24 | MessageQueue create(String name, MessageHandler messageHandler) throws Exception; 25 | } 26 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/messaging/MessageQueueFactoryFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface MessageQueueFactoryFactory { 24 | MessageQueueFactory create(String clusterName); 25 | } 26 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/messaging/MessagingService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | import org.elasticsoftware.elasticactors.PhysicalNode; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public interface MessagingService { 28 | void sendWireMessage(String queueName, byte[] serializedMessage, PhysicalNode receiver) throws IOException; 29 | } 30 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/messaging/MessagingServiceInitializationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.messaging; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public final class MessagingServiceInitializationException extends RuntimeException { 24 | private final boolean recoverable; 25 | 26 | public MessagingServiceInitializationException(String message, boolean recoverable) { 27 | super(message); 28 | this.recoverable = recoverable; 29 | } 30 | 31 | public MessagingServiceInitializationException(String message, Throwable cause, boolean recoverable) { 32 | super(message, cause); 33 | this.recoverable = recoverable; 34 | } 35 | 36 | public boolean isRecoverable() { 37 | return recoverable; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/reactivestreams/InternalPersistentSubscription.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.reactivestreams; 19 | 20 | import org.elasticsoftware.elasticactors.PersistentSubscription; 21 | import org.reactivestreams.Subscriber; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface InternalPersistentSubscription extends PersistentSubscription { 27 | 28 | Subscriber getSubscriber(); 29 | } 30 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/reactivestreams/ProcessorContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.reactivestreams; 19 | 20 | /** 21 | * @author Joost van de Wijgerd 22 | */ 23 | public interface ProcessorContext { 24 | void addSubscription(InternalPersistentSubscription persistentSubscription); 25 | } 26 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/serialization/SerializationAccessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization; 19 | 20 | public interface SerializationAccessor { 21 | 22 | /** 23 | * Return the serializer for the given message type 24 | * 25 | * @param messageClass 26 | * @param 27 | * @return 28 | */ 29 | MessageSerializer getSerializer(Class messageClass); 30 | 31 | /** 32 | * Return the deserializer for the give message type 33 | * 34 | * @param messageClass 35 | * @param 36 | * @return 37 | */ 38 | MessageDeserializer getDeserializer(Class messageClass); 39 | } 40 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/serialization/SerializationFrameworks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.serialization; 19 | 20 | public interface SerializationFrameworks { 21 | 22 | MessageSerializer getSystemMessageSerializer(Class messageClass); 23 | 24 | MessageDeserializer getSystemMessageDeserializer(Class messageClass); 25 | 26 | SerializationFramework getSerializationFramework(Class frameworkClass); 27 | } 28 | -------------------------------------------------------------------------------- /main/spi/src/main/java/org/elasticsoftware/elasticactors/state/ActorStateUpdateListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.state; 19 | 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * @author Joost van de Wijgerd 25 | */ 26 | public interface ActorStateUpdateListener { 27 | void onUpdate(List updates); 28 | } 29 | -------------------------------------------------------------------------------- /main/test/src/main/java/org/elasticsoftware/elasticactors/test/cluster/UnsupportedThreadBoundExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test.cluster; 19 | 20 | import org.elasticsoftware.elasticactors.util.concurrent.ThreadBoundEvent; 21 | import org.elasticsoftware.elasticactors.util.concurrent.ThreadBoundExecutor; 22 | 23 | public final class UnsupportedThreadBoundExecutor> 24 | implements ThreadBoundExecutor { 25 | 26 | @Override 27 | public void execute(T runnable) { 28 | throw new UnsupportedOperationException("Dummy executor does not support running tasks"); 29 | } 30 | 31 | @Override 32 | public void shutdown() { 33 | 34 | } 35 | 36 | @Override 37 | public int getThreadCount() { 38 | return 1; 39 | } 40 | 41 | @Override 42 | public void init() { 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /main/test/src/main/java/org/elasticsoftware/elasticactors/test/messaging/UnsupportedMessageQueueFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test.messaging; 19 | 20 | import org.elasticsoftware.elasticactors.messaging.MessageHandler; 21 | import org.elasticsoftware.elasticactors.messaging.MessageQueue; 22 | import org.elasticsoftware.elasticactors.messaging.MessageQueueFactory; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public final class UnsupportedMessageQueueFactory implements MessageQueueFactory { 28 | @Override 29 | public MessageQueue create(String name, MessageHandler messageHandler) throws Exception { 30 | throw new UnsupportedOperationException("Remote Queues not supported in test mode"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /main/test/src/main/java/org/elasticsoftware/elasticactors/test/messaging/UnsupportedMessageQueueFactoryFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test.messaging; 19 | 20 | import org.elasticsoftware.elasticactors.messaging.MessageQueueFactory; 21 | import org.elasticsoftware.elasticactors.messaging.MessageQueueFactoryFactory; 22 | 23 | public final class UnsupportedMessageQueueFactoryFactory implements MessageQueueFactoryFactory { 24 | 25 | @Override 26 | public MessageQueueFactory create(String clusterName) { 27 | throw new UnsupportedOperationException("Remote Queues not supported in test mode"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /main/test/src/test/java/org/elasticsoftware/elasticactors/test/ContextTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test; 19 | 20 | import org.testng.annotations.Test; 21 | 22 | public class ContextTest { 23 | 24 | @Test 25 | public void contextLoads() { 26 | TestActorSystem testActorSystem = new TestActorSystem(ContextTestConfiguration.class, true); 27 | testActorSystem.initialize(); 28 | 29 | testActorSystem.destroy(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /main/test/src/test/java/org/elasticsoftware/elasticactors/test/ManifestToolsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test; 19 | 20 | import org.elasticsoftware.elasticactors.base.state.StringState; 21 | import org.elasticsoftware.elasticactors.util.ManifestTools; 22 | import org.testng.annotations.Test; 23 | 24 | /** 25 | * @author Joost van de Wijgerd 26 | */ 27 | public class ManifestToolsTest { 28 | @Test 29 | public void testGetVersion() { 30 | System.out.println(ManifestTools.extractVersion(StringState.class)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /main/test/src/test/java/org/elasticsoftware/elasticactors/test/ask/AfterHandlers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test.ask; 19 | 20 | import org.elasticsoftware.elasticactors.MessageHandler; 21 | import org.elasticsoftware.elasticactors.MethodActor; 22 | 23 | public class AfterHandlers extends MethodActor { 24 | 25 | @MessageHandler(order = MessageHandler.LOWEST_PRECEDENCE) 26 | public void handleAfter(AskForGreeting greeting) { 27 | logger.info("Got REQUEST in Thread {} (last handler)", Thread.currentThread().getName()); 28 | AskForGreetingActor.checkHandlerOrder(2); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /main/test/src/test/java/org/elasticsoftware/elasticactors/test/ask/BeforeHandlers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test.ask; 19 | 20 | import org.elasticsoftware.elasticactors.MessageHandler; 21 | import org.elasticsoftware.elasticactors.MethodActor; 22 | 23 | public class BeforeHandlers extends MethodActor { 24 | 25 | @MessageHandler(order = MessageHandler.HIGHEST_PRECEDENCE) 26 | public void handleBefore(AskForGreeting greeting) { 27 | logger.info("Got REQUEST in Thread {} (first handler)", Thread.currentThread().getName()); 28 | AskForGreetingActor.checkHandlerOrder(0); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /main/test/src/test/java/org/elasticsoftware/elasticactors/test/common/GetActorName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test.common; 19 | 20 | import org.elasticsoftware.elasticactors.base.serialization.JacksonSerializationFramework; 21 | import org.elasticsoftware.elasticactors.serialization.Message; 22 | 23 | import static org.elasticsoftware.elasticactors.serialization.Message.LogFeature.CONTENTS; 24 | import static org.elasticsoftware.elasticactors.serialization.Message.LogFeature.TIMING; 25 | 26 | @Message( 27 | serializationFramework = JacksonSerializationFramework.class, 28 | immutable = true, 29 | logBodyOnError = true, 30 | logOnReceive = {TIMING, CONTENTS}) 31 | public class GetActorName { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /main/test/src/test/java/org/elasticsoftware/elasticactors/test/common/IScheduledGreeting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test.common; 19 | 20 | import org.elasticsoftware.elasticactors.scheduler.ScheduledMessageRef; 21 | 22 | public interface IScheduledGreeting { 23 | 24 | ScheduledMessageRef getMessageRef(); 25 | } 26 | -------------------------------------------------------------------------------- /main/test/src/test/java/org/elasticsoftware/elasticactors/test/common/InitialNameStateProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test.common; 19 | 20 | import org.elasticsoftware.elasticactors.ActorState; 21 | import org.elasticsoftware.elasticactors.InitialStateProvider; 22 | 23 | public class InitialNameStateProvider implements InitialStateProvider { 24 | 25 | @Override 26 | public ActorState getInitialState( 27 | String actorId, 28 | Class stateClass) throws Exception { 29 | return new NameActorState(actorId); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /main/test/src/test/java/org/elasticsoftware/elasticactors/test/reactivestreams/StreamFinishedMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.test.reactivestreams; 19 | 20 | import org.elasticsoftware.elasticactors.base.serialization.JacksonSerializationFramework; 21 | import org.elasticsoftware.elasticactors.serialization.Message; 22 | 23 | import static org.elasticsoftware.elasticactors.serialization.Message.LogFeature.CONTENTS; 24 | import static org.elasticsoftware.elasticactors.serialization.Message.LogFeature.TIMING; 25 | 26 | /** 27 | * @author Joost van de Wijgerd 28 | */ 29 | @Message( 30 | serializationFramework = JacksonSerializationFramework.class, 31 | immutable = true, 32 | durable = false, 33 | logBodyOnError = true, 34 | logOnReceive = {TIMING, CONTENTS}) 35 | public final class StreamFinishedMessage { 36 | } 37 | -------------------------------------------------------------------------------- /main/test/src/test/resources/META-INF/elasticactors.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | basePackage=org.elasticsoftware.elasticactors.test -------------------------------------------------------------------------------- /main/test/src/test/resources/ea-test.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: test 3 | shards: 8 4 | #shards: 128 5 | #queuesPerNode: 8 6 | #queuesPerShard: 2 7 | #shardHashSeed: 0 8 | #multiQueueHashSeed: 53 9 | #shardDistributionHashSeed: 53 -------------------------------------------------------------------------------- /main/test/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.slf4j.simpleLogger.showDateTime=true 19 | org.slf4j.simpleLogger.showLogName=false 20 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS -------------------------------------------------------------------------------- /main/tracing-slf4j/src/main/resources/META-INF/services/org.elasticsoftware.elasticactors.tracing.LogContextProcessor: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.elasticsoftware.elasticactors.tracing.service.Slf4jLogContextProcessor -------------------------------------------------------------------------------- /main/tracing-spring/src/main/java/org/elasticsoftware/elasticactors/tracing/spring/AsyncDefaultConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.tracing.spring; 19 | 20 | import org.springframework.context.annotation.Bean; 21 | import org.springframework.context.annotation.Configuration; 22 | 23 | @Configuration(proxyBeanMethods = false) 24 | public class AsyncDefaultConfiguration { 25 | 26 | @Bean 27 | public static ExecutorBeanPostProcessor executorBeanPostProcessor() { 28 | return new ExecutorBeanPostProcessor(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /main/tracing-spring/src/main/java/org/elasticsoftware/elasticactors/tracing/spring/LazyTraceExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.elasticsoftware.elasticactors.tracing.spring; 19 | 20 | import java.util.concurrent.Executor; 21 | 22 | class LazyTraceExecutor implements Executor { 23 | 24 | private final Executor delegate; 25 | 26 | LazyTraceExecutor(Executor delegate) { 27 | this.delegate = delegate; 28 | } 29 | 30 | @Override 31 | public void execute(Runnable command) { 32 | this.delegate.execute(TraceRunnable.wrap(command)); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /main/tracing-spring/src/main/java/org/elasticsoftware/elasticactors/tracing/spring/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 - 2025 The Original Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | @NonNullApi 19 | package org.elasticsoftware.elasticactors.tracing.spring; 20 | 21 | import org.springframework.lang.NonNullApi; -------------------------------------------------------------------------------- /main/tracing/src/main/resources/META-INF/services/org.elasticsoftware.elasticactors.tracing.MessagingContextManager: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 - 2025 The Original Authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | org.elasticsoftware.elasticactors.tracing.service.TracingMessagingContextManager --------------------------------------------------------------------------------