zio / zio-akka-cluster Goto Github PK
View Code? Open in Web Editor NEWZIO wrapper for Akka Cluster
Home Page: https://zio.dev/zio-akka-cluster
License: Apache License 2.0
ZIO wrapper for Akka Cluster
Home Page: https://zio.dev/zio-akka-cluster
License: Apache License 2.0
I´m trying to send a message from one ActorSystem to another.
The publisher in port 2700 and listener in 2600.
But checking the logs it seems it´s trying to publish the message from the listener port 2600 to another actor without port Actor[akka://ClusterSystem/system/distributedPubSubMediator]
[INFO] [07/18/2019 16:26:55.893] [ClusterSystem-akka.actor.default-dispatcher-3] [akka://ClusterSystem/system/distributedPubSubMediator] Message [akka.cluster.pubsub.DistributedPubSubMediator$Internal$Status] from Actor[akka.tcp://[email protected]:2600/system/distributedPubSubMediator#-327490257] to Actor[akka://ClusterSystem/system/distributedPubSubMediator] was not delivered. [2] dead letters encountered. If this is not an expected behavior, then [Actor[akka://ClusterSystem/system/distributedPubSubMediator]] may have terminated unexpectedly, This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [07/18/2019 16:26:55.893] [ClusterSystem-akka.actor.default-dispatcher-3] [akka://ClusterSystem/system/distributedPubSubMediator] Message [akka.cluster.pubsub.DistributedPubSubMediator$Internal$Status] from Actor[akka.tcp://[email protected]:2600/system/distributedPubSubMediator#-327490257] to Actor[akka://ClusterSystem/system/distributedPubSubMediator] was not delivered. [2] dead letters encountered. If this is not an expected behavior, then [Actor[akka://ClusterSystem/system/distributedPubSubMediator]] may have terminated unexpectedly, This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [07/18/2019 16:26:56.883] [ClusterSystem-akka.actor.default-dispatcher-23] [akka://ClusterSystem/system/distributedPubSubMediator] Message [akka.cluster.pubsub.DistributedPubSubMediator$Internal$Status] from Actor[akka.tcp://[email protected]:2600/system/distributedPubSubMediator#-327490257] to Actor[akka://ClusterSystem/system/distributedPubSubMediator] was not delivered. [3] dead letters encountered. If this is not an expected behavior, then [Actor[akka://ClusterSystem/system/distributedPubSubMediator]] may have terminated unexpectedly, This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [07/18/2019 16:26:57.872] [ClusterSystem-akka.actor.default-dispatcher-23] [akka://ClusterSystem/system/distributedPubSubMediator] Message [akka.cluster.pubsub.DistributedPubSubMediator$Internal$Status] from Actor[akka.tcp://[email protected]:2600/system/distributedPubSubMediator#-327490257] to Actor[akka://ClusterSystem/system/distributedPubSubMediator] was not delivered. [4] dead letters encountered. If this is not an expected behavior, then [Actor[akka://ClusterSystem/system/distributedPubSubMediator]] may have terminated unexpectedly, This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [07/18/2019 16:26:58.896] [ClusterSystem-akka.actor.default-dispatcher-3] [akka://ClusterSystem/system/distributedPubSubMediator] Message [akka.cluster.pubsub.DistributedPubSubMediator$Internal$Status] from Actor[akka.tcp://[email protected]:2600/system/distributedPubSubMediator#-327490257] to Actor[akka://ClusterSystem/system/distributedPubSubMediator] was not delivered. [5] dead letters encountered. If this is not an expected behavior, then [Actor[akka://ClusterSystem/system/distributedPubSubMediator]] may have terminated unexpectedly, This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [07/18/2019 16:26:59.877] [ClusterSystem-akka.actor.default-dispatcher-24] [akka://ClusterSystem/system/distributedPubSubMediator] Message [akka.cluster.pubsub.DistributedPubSubMediator$Internal$Status] from Actor[akka.tcp://[email protected]:2600/system/distributedPubSubMediator#-327490257] to Actor[akka://ClusterSystem/system/distributedPubSubMediator] was not delivered. [6] dead letters encountered. If this is not an expected behavior, then [Actor[akka://ClusterSystem/system/distributedPubSubMediator]] may have terminated unexpectedly, This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[WARN] [SECURITY][07/18/2019 16:27:00.042] [pool-2-thread-2] [akka.serialization.Serialization(akka://ClusterSystem)] Using the default Java serializer for class [zio.akka.cluster.pubsub.MessageEnvelope] which is not recommended because of performance implications. Use another serializer or disable this warning using the setting 'akka.actor.warn-about-java-serializer-usage'
[INFO] [07/18/2019 16:27:00.047] [ClusterSystem-akka.actor.default-dispatcher-3] [akka://ClusterSystem/system/distributedPubSubMediator] Message [zio.akka.cluster.pubsub.MessageEnvelope] without sender to Actor[akka://ClusterSystem/system/distributedPubSubMediator#2077152297] was not delivered. [7] dead letters encountered. If this is not an expected behavior, then [Actor[akka://ClusterSystem/system/distributedPubSubMediator#2077152297]] may have terminated unexpectedly, This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
Any idea if I´m doing something wrong?, here the code
val messageProgram: ZIO[ActorSystem, Throwable, String] = (for {
remotePort <- ZIO.accessM[ActorSystem](as => ZIO.effect(as.settings.config.getString("akka.remote.netty.tcp.port")))
state <- Cluster.clusterState
_ <- logClusterInfo(remotePort, state)
_ <- if (state.members.size > 1) {
//Wait until the other node accept the new member
Thread.sleep(5000)
for {
pubSub <- PubSub.createPubSub[String]
_ <- pubSub.publish(ToggleTopic, "Hello ZIO world")
} yield Unit
}else{
ZIO.effect(Unit)
}
subscriber <- PubSub.createSubscriber[String]
queue <- subscriber.listen(ToggleTopic)
message <- queue.take
} yield message).catchAll(t => {
logger.info(null, "Error in ZIO Akka cluster:")
ZIO.fail(t)
})
As far as I can see in the akka log, the cluster is formed
Members:TreeSet(Member(address = akka.tcp://[email protected]:2600, status = Up), Member(address = akka.tcp://[email protected]:2700, status = Up))
Any idea what it could be wrong?
Regards
Replace scalatest by ZIO Test
Hi again,
I think I´m facing a possible Race condition using
val clusterEvents: ZIO[ActorSystem, Throwable, Queue[ClusterDomainEvent]] =
Queue.unbounded[ClusterDomainEvent].tap(clusterEventsWith)
This queue is filled with the events of actions over the cluster.
The problem is that the ActorSystem
has been created previously passed as provider into the Monad ZIO[ActorSystem, Throwable, Any]
mainProgram.unsafeRunToFuture(bootableProgram.provide(actorSystem))
so it happening sometimes that the Member is added into the cluster before I subscribe into the Queue so I´m missing that event.
events <- Cluster.clusterEvents
event <-events.take
Any suggestion to prevent that RC?
I guess not pass the ActorSystem
as Environment when I run the monad and pass into the Cluster.clusterEvents,
is an option but definitely less cool option :(
events <- Cluster.clusterEvents.provide(ActorSystem.create("bla"))
event <-events.take
Regards.
ZIO is at Milestone 4, with an RC expected in the next few weeks.
https://github.com/zio/zio/releases/tag/v2.The API is nearly stable at this point, so any early migration work against this version should pay off towards the official 2.0 release.
The progress is being tracked here:
zio/zio#5470
The Stream Encoding work in progress is the only area where the API might still change before the RC.
To assist with the migration, follow this guide:
https://zio.dev/howto/migrate/zio-2.x-migration-guide/
We are actively working on a ScalaFix rule that will cover the bulk of the simple API changes:
https://github.com/zio/zio/blob/series/2.x/scalafix/rules/src/main/scala/fix/Zio2Upgrade.scala
If you would like assistance with the migration from myself or other ZIO contributors, please let us know!
Would be useful to have the definition for
onMessage: Msg => ZIO[Entity[State], Nothing, Unit]
in Sharding.start
to accept more environment, and provide it from outside like
Sharding.start(...).provideLayer(layerForOnMessage)`
ZIO now support Scala 2.13, so this library should too.
Hello, I am new to zio and akka, and maybe it is best we add support for akk-typed because most new developers are into akka-typed like me. Thanks!
I noticed Sharding
had send
and stop
but it would be nice to support the ask
pattern as well
I´m trying to use the library, but I´m not able to run the ZIO.
Here my code:
val main: DefaultRuntime = new DefaultRuntime {}
val clusterStateProgram: ZIO[ActorSystem, Throwable, CurrentClusterState] =
for {
state <- Cluster.clusterState
state <- logClusterInfo(state)
} yield state
main.unsafeRun(clusterStateProgram)
and the compilation error
Error:(64, 22) type mismatch;
found : zio.ZIO[akka.actor.ActorSystem,Throwable,akka.cluster.ClusterEvent.CurrentClusterState]
required: zio.ZIO[zio.clock.Clock with zio.console.Console with zio.system.System with zio.random.Random with zio.blocking.Blocking,?,?]
main.unsafeRun(clusterStateProgram)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.