These are chat archives for akkadotnet/akka.net

28th
Dec 2016
Vagif Abilov
@object
Dec 28 2016 13:48
I am getting strange results when using CurrentEventsByPersistenceId with persistence queries. Instead of 1 result per a combination of PersistenceId+SequenceNr I get 1 result for each event adapter. In the HOCON section I have 4 event adapters and even though there is only 1 event with the given PersistenceId+SequenceNr in the whole database, I get back 4 events for each combincation: one correct event and 3 empty events for other adapters.
Here is my HOCON section:
event-adapters {
akamai-disk-volume = "Nrk.Odd.Tanner.PersistenceUtils+EventAdapter1[[Nrk.Odd.Tanner.PersistentTypes+AkamaiDiskUsage, Tanner]], Tanner" akamai-storage-assignment = "Nrk.Odd.Tanner.PersistenceUtils+EventAdapter1[[Nrk.Odd.Tanner.PersistentTypes+AkamaiStorageAssignment, Tanner]], Tanner"
origin-storage-assignment = "Nrk.Odd.Tanner.PersistenceUtils+EventAdapter1[[Nrk.Odd.Tanner.PersistentTypes+OriginStorageAssignment, Tanner]], Tanner" file-distribution = "Nrk.Odd.Tanner.PersistenceUtils+EventAdapter1[[Nrk.Odd.Tanner.PersistentTypes+FileDistribution, Tanner]], Tanner"
}
And here is the code:
let queries = PersistenceQuery.Get(system).ReadJournalFor<SqlReadJournal>("akka.persistence.query.journal.sql")
let mat = ActorMaterializer.Create(system)
let aggregateEvents acc item = acc + 1
queries.CurrentEventsByPersistenceId("file-distribution:ps~msus13001916~msus13001916aa~msus13001916aa_id270.mp4", 0L, System.Int64.MaxValue)
.RunAggregate(0, System.Func<int, EventEnvelope, int> aggregateEvents, mat)
|> Async.AwaitTask
|> Async.RunSynchronously
Vagif Abilov
@object
Dec 28 2016 14:03
UPDATE. What I found it is that if I replace this HOCON line in event-adapter-bindings:
"Newtonsoft.Json.Linq.JObject, Newtonsoft.Json" = [akamai-disk-volume,akamai-storage-assignment,origin-storage-assignment,file-distribution]
with this one:
"Newtonsoft.Json.Linq.JObject, Newtonsoft.Json" = [file-distribution]
then everything works OK. But I don't think this is correct configuration because I only list one event adapter (and I have 3 others for other persistent actor types).
Vagif Abilov
@object
Dec 28 2016 14:33
I think I've figured it out: I can only have 1 adapter that converts events from a given type (JSON in my case) to Journal.
Actually quite logical :-)
Alex Michel
@amichel
Dec 28 2016 15:00
What do I need to change in HOCON when running ClusterSharding proxy instead of node? I copied the config and system creation from node console app which works and when using StartProxy I can't manage to connect to cluster
I am using LightHouse as seed node
akka {
actor {
provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
serializers {
wire = "Akka.Serialization.WireSerializer, Akka.Serialization.Wire"
}
serialization-bindings {
"System.Object" = wire
}
}
remote {
helios.tcp {
        #public-hostname = "localhost"
        hostname = "localhost"
        port = 0
      }
    }
    cluster {
      auto-down-unreachable-after = 5s
      sharding {
        least-shard-allocation-strategy.rebalance-threshold = 3
        role = sharding
      }
      seed-nodes = ["akka.tcp://sharded-cluster-system@127.0.0.1:4053"]          
      roles=[sharding]
    }

    persistence {
       publish-plugin-commands = on
        journal {
          plugin = "akka.persistence.journal.sql-server"
          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 = "Sandbox"
           }
        }
        snapshot-store {
               plugin = "akka.persistence.snapshot-store.sql-server"
               sql-server {
                   class = "Akka.Persistence.SqlServer.Snapshot.SqlServerSnapshotStore, Akka.Persistence.SqlServer"
                   plugin-dispatcher = "akka.actor.default-dispatcher"
                   table-name = SnapshotStore
                   schema-name = dbo
                   auto-initialize = on
                   connection-string-name = "Sandbox"
               }
        }
    }
  }
Mike Clark
@mclark1129
Dec 28 2016 19:51
I'd like to better understand how Akka.NET might be used in a microservices architecture. Is it common to use a single actor system and just deploy your microservices as individual actors under the same system? Or is it a more common practice to implement your microservice as an instance of an actor system, with its components being made up of actors?
simonpetty
@simonpetty
Dec 28 2016 21:16
Hi all. I have a question about Persistence.Query.Sql...hoping someone can shed some light
what about this project is SQL specific if it all hooks into the standard Persistence API ?
seems odd to couple the query logic to a particular backend store