小编mko*_*man的帖子

基于微服务的架构和每个节点的单独缓存

在分布式微服务应用程序中为每个节点使用分离的本地缓存是不正确的做法?我听说在单片应用程序中使用本地EHCache作为Hibernate的二级缓存提供程序是可以的,但在分布式环境中,通常的做法是使用分布式缓存,例如Memcached,Redis或Hazelcast.为每个节点使用单独的缓存有什么后果?

java architecture caching hibernate microservices

3
推荐指数
1
解决办法
2106
查看次数

Akka actor 未使用 DistributedPubSub 接收消息

我尝试让 akka 集群与分布式消息一起工作,但我陷入困境。我的演员已正确启动并订阅主题,但未收到任何消息。这是代码

import akka.actor.{Actor, ActorSystem, Props}
import akka.cluster.client.ClusterClient.Publish
import akka.cluster.pubsub.DistributedPubSub
import akka.cluster.pubsub.DistributedPubSubMediator.{Subscribe, SubscribeAck}

case object DistributedMessage

object ClusterExample extends App {
  val system = ActorSystem("ClusterSystem")
  val actor = system.actorOf(Props(classOf[ClusterExample]), "clusterExample")
}

class ClusterExample extends Actor {
  private val mediator = DistributedPubSub(context.system).mediator

  mediator ! Subscribe("content", self)

  override def receive = {
    case SubscribeAck(Subscribe("content", None, `self`)) =>
      (1 to 100) foreach (_ => {
        mediator ! Publish("content", msg = DistributedMessage)
      })

    case DistributedMessage => println("received message from queue!")
  }
}
Run Code Online (Sandbox Code Playgroud)

这是配置: …

scala akka

0
推荐指数
1
解决办法
578
查看次数

标签 统计

akka ×1

architecture ×1

caching ×1

hibernate ×1

java ×1

microservices ×1

scala ×1