首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >akka.cluster与持久化交付问题

akka.cluster与持久化交付问题
EN

Stack Overflow用户
提问于 2017-07-15 10:58:11
回答 1查看 186关注 0票数 0

在我们的集群中,我们有以下四个节点组合:

  • 2个种子节点(后端)
  • 1名工人
  • 一个关于IIS的webapi

集群被加入、启动并运行;当我向webapi发送一个帖子时,:

  • IIS加入群集
  • API接收一个帖子并发送消息
  • 消息被处理了两三次!
  • 只发生在IIS连接时发送的消息,下面的消息运行良好

以下是我的IIS配置:

代码语言:javascript
复制
<akka>
  <hocon>
    <![CDATA[
            akka.loglevel = INFO
            akka.log-config-on-start = off
            akka.stdout-loglevel = INFO
            akka.actor {
                provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
                deployment {
                  /TheProcess {
                    router = round-robin-group
                    routees.paths = ["/user/TheProcess"] # path of routee on each node
                    # nr-of-instances = 3 # max number of total routees
                    cluster {
                        enabled = on
                        allow-local-routees = off
                        use-role = TheProcess
                    }
                  }                            
                }
                debug {
                  receive = on
                  autoreceive = on
                  lifecycle = on
                  event-stream = on
                  unhandled = on
                }
            }
            akka.remote {
                helios.tcp {
                    # transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
                    # applied-adapters = []
                    # transport-protocol = tcp
                              # public-hostname = "localhost"
                    # 0 or 46001-46010
                    port = 0
                    hostname = "localhost"
                }
                log-remote-lifecyclo-events = DEBUG
            }
            akka.cluster {
              seed-nodes = [
                "akka.tcp://ActorSystem@localhost:2551",
                "akka.tcp://ActorSystem@localhost:2552"
              ]
              roles = [TheSend]
              # auto-down-unreachable-after = 10s
              # how often should the node send out gossip information?
              # gossip-interval = 1s
              # discard incoming gossip messages if not handled within this duration
              # gossip-time-to-live = 2s              
            }
            # http://getakka.net/docs/persistence/at-least-once-delivery
            akka.persistence.at-least-once-delivery.redeliver-interval = 300s
            # akka.persistence.at-least-once-delivery.redelivery-burst-limit =
            # akka.persistence.at-least-once-delivery.warn-after-number-of-unconfirmed-attempts =
            akka.persistence.at-least-once-delivery.max-unconfirmed-messages = 1000000
            akka.persistence.journal.plugin = "akka.persistence.journal.sql-server"
            akka.persistence.journal.publish-plugin-commands = on
            akka.persistence.journal.sql-server {
                class = "Akka.Persistence.SqlServer.Journal.SqlServerJournal, Akka.Persistence.SqlServer"
                plugin-dispatcher = "akka.actor.default-dispatcher"
                table-name = EventJournal
                schema-name = dbo
                auto-initialize = on
                connection-string-name = "AkkaPersistence"
                refresh-interval = 1s
                connection-timeout = 30s
                timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
                metadata-table-name = Metadata
            }
            akka.persistence.snapshot-store.plugin = ""akka.persistence.snapshot-store.sql-server""
            akka.persistence.snapshot-store.sql-server {
              class = "Akka.Persistence.SqlServer.Snapshot.SqlServerSnapshotStore, Akka.Persistence.SqlServer"
              plugin-dispatcher = ""akka.actor.default-dispatcher""
              connection-string-name = "AkkaPersistence"
              schema-name = dbo
              table-name = SnapshotStore
              auto-initialize = on
            }
      ]]>
  </hocon>

下面是我的后端配置:

代码语言:javascript
复制
  <hocon>
    <![CDATA[
        akka.loglevel = INFO
        akka.log-config-on-start = on
        akka.stdout-loglevel = INFO
        akka.actor {
            provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
            debug {
              receive = on
              autoreceive = on
              lifecycle = on
              event-stream = on
              unhandled = on
            }
        }
        akka.remote {
          helios.tcp {
                # transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
                # applied-adapters = []
                # transport-protocol = tcp
                        # public-hostname = "localhost"
                # 
                # seed-node ports 2551 and 2552
                # non-seed-node port 0 or 46001-46010
                port = 2551
                hostname = "localhost"
            }
            log-remote-lifecyclo-events = INFO
        }
        akka.cluster {
          seed-nodes = [
            "akka.tcp://ActorSystem@localhost:2551",
            "akka.tcp://ActorSystem@localhost:2552"
          ]
          roles = [TheProcess]
          # auto-down-unreachable-after = 10s
        }
      ]]>
  </hocon>

我认为这个问题是与akka持久力有关的,问题是什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-04 11:59:58

最后,必须根据IIS实例设置persistenceId,如下所述:

标识符 持久性参与者必须具有一个标识符,该标识符不会在不同的参与者化身之间发生变化。必须使用PersistenceId方法定义标识符。

因此,我放置了一个配置键,以便为每个特定的persistenceId实例设置正确的IIS。

如果在ReceiveCommand上执行一个UnstashAll,也会缺少一个其他的,这会导致多个交付。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45117392

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档