These are chat archives for akkadotnet/akka.net

18th
Dec 2018
Shukhrat Nekbaev
@snekbaev
Dec 18 2018 00:32
ok, I can confirm it is exactly that. Added the address family and bingo, will open a GitHub issue
Chris G. Stevens
@cgstevens
Dec 18 2018 00:46
@Havret and @AndreSteenbergen
Thanks for the replies! Sorry i have not been on as I have been head down.
I did end up just injecting the DistributedPubSub into my actor and everything seems to be working great.
Thanks you for your help last week.
Peter Huang
@angrybug
Dec 18 2018 01:35
Version tolerance of Hyperion - if a new version of an assembly adds a new property to a type, and the VersionTolerance setting is true, should it successfully deserialize a stream to the new version? Had a look at DefaultCodeGenerator.cs, it seems the field orders are important. But even if that's observed, I've got a gist that seems to fail when adding new property. https://gist.github.com/angrybug/5e63b0ac8945d51fd62f5279a5db6c0d Often, we upgrade a microservice adding a few properties, it would be nice to just swap over to new version without recompiling all the dependent services. Is it general best practice to turn version tolerance off?
Shukhrat Nekbaev
@snekbaev
Dec 18 2018 01:38
here's the issue: akkadotnet/akka.net#3679
Peter Huang
@angrybug
Dec 18 2018 02:37
@HIPERCUBE doesn't look like it. It's tricky to implement the query API as it is supposed to be able to monitor log additions. For many rdbms that means polling which is hard to make performant
joowon
@HIPERCUBE
Dec 18 2018 02:53
@angrybug https://github.com/AkkaNetContrib/Akka.Persistence.PostgreSql/tree/dev/src/Akka.Persistence.PostgreSql.Tests/Query
I found persistence-query related test code in postgresql provider repo
Is it meaningless test code?
joowon
@HIPERCUBE
Dec 18 2018 03:01
‘’’
ReadJournal = Sys.ReadJournalFor<SqlReadJournal>(SqlReadJournal.Identifier);
‘’’
It seems like using ‘SqlReadJournal’ for persistence query when using postgresql.
I tried with SqlReadJournal and postgrsql, but it doesn’t work.
Onur Gumus
@OnurGumus
Dec 18 2018 03:40
@Horusiath thanks , though my real question is this, if I create a persistent actor from scratch, does it go to database on its recovery phase ?
Peter Huang
@angrybug
Dec 18 2018 04:52
@HIPERCUBE that's the generic polling implementation for all sql - it should work, what errors do you see?
Peter Huang
@angrybug
Dec 18 2018 05:05
Peter Huang
@angrybug
Dec 18 2018 05:18
and from then on, it just uses new events written to inform the query side (my mistake - i thought it polls)
joowon
@HIPERCUBE
Dec 18 2018 06:12
@angrybug I can't find any error logs.
image.png
I tried to select events by PersistenceId with upper code, but it doesn't work. It was not printed at all.
Also i checked the DB log, but there's no select request at all.
Peter Huang
@angrybug
Dec 18 2018 06:19
Can you paste in the config?
joowon
@HIPERCUBE
Dec 18 2018 06:21
akka {
  cluster.sharding {
    journal-plugin-id = "akka.persistence.journal.sharding"
    snapshot-plugin-id = "akka.persistence.snapshot-store.sharding"
  }

  persistence {
    journal {
      plugin = "akka.persistence.journal.postgresql"
      postgresql {
        class = "Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql"
        plugin-dispatcher = "akka.actor.default-dispatcher"
        connection-string = "Correct connection string"
        connection-timeout = 30s
        schema-name = public
        table-name = event_journal
        auto-initialize = on
        timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
        metadata-table-name = metadata
        stored-as = BYTEA
        refresh-interval = 1s
      }
      sharding {
        connection-string = "Correct connection string"
        auto-initialize = on
        plugin-dispatcher = "akka.actor.default-dispatcher"
        class = "Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql"
        connection-timeout = 30s
        schema-name = public
        timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
        metadata-table-name = sharding_metadata
      }
    }

    sharding {
      journal-plugin-id = "akka.persistence.journal.sharding"
      snapshot-plugin-id = "akka.persistence.snapshot-store.sharding"
    }

    snapshot-store {
      plugin = "akka.persistence.snapshot-store.postgresql"
      postgresql {
        class = "Akka.Persistence.PostgreSql.Snapshot.PostgreSqlSnapshotStore, Akka.Persistence.PostgreSql"
        plugin-dispatcher = "akka.actor.default-dispatcher"
        connection-string = "Correct connection string"
        connection-timeout = 30s
        schema-name = public
        table-name = snapshot_store
        auto-initialize = on
        stored-as = BYTEA
      }
      sharding {
        class = "Akka.Persistence.PostgreSql.Snapshot.PostgreSqlSnapshotStore, Akka.Persistence.PostgreSql"
        plugin-dispatcher = "akka.actor.default-dispatcher"
        connection-string = "Correct connection string"
        connection-timeout = 30s
        schema-name = public
        table-name = sharding_snapshot_store
        auto-initialize = on
      }
    }
  }
}
akka {
  cluster.sharding {
    journal-plugin-id = "akka.persistence.journal.sharding"
    snapshot-plugin-id = "akka.persistence.snapshot-store.sharding"
  }

  persistence {
    journal {
      plugin = "akka.persistence.journal.postgresql"
      postgresql {
        class = "Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql"
        plugin-dispatcher = "akka.actor.default-dispatcher"
        connection-string = "Correct connection string"
        connection-timeout = 30s
        schema-name = public
        table-name = event_journal
        auto-initialize = on
        timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
        metadata-table-name = metadata
        stored-as = BYTEA
        refresh-interval = 1s
      }
      sharding {
        connection-string = "Correct connection string"
        auto-initialize = on
        plugin-dispatcher = "akka.actor.default-dispatcher"
        class = "Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql"
        connection-timeout = 30s
        schema-name = public
        timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
        metadata-table-name = sharding_metadata
      }
    }

    sharding {
      journal-plugin-id = "akka.persistence.journal.sharding"
      snapshot-plugin-id = "akka.persistence.snapshot-store.sharding"
    }

    snapshot-store {
      plugin = "akka.persistence.snapshot-store.postgresql"
      postgresql {
        class = "Akka.Persistence.PostgreSql.Snapshot.PostgreSqlSnapshotStore, Akka.Persistence.PostgreSql"
        plugin-dispatcher = "akka.actor.default-dispatcher"
        connection-string = "Correct connection string"
        connection-timeout = 30s
        schema-name = public
        table-name = snapshot_store
        auto-initialize = on
        stored-as = BYTEA
      }
      sharding {
        class = "Akka.Persistence.PostgreSql.Snapshot.PostgreSqlSnapshotStore, Akka.Persistence.PostgreSql"
        plugin-dispatcher = "akka.actor.default-dispatcher"
        connection-string = "Correct connection string"
        connection-timeout = 30s
        schema-name = public
        table-name = sharding_snapshot_store
        auto-initialize = on
      }
    }

    query.journal.sql {
      class = "Akka.Persistence.Query.Sql.SqlReadJournalProvider, Akka.Persistence.Query.Sql"
      refresh-interval = 1s
      max-buffer-size = 100
    }
  }
}
I tried both of them
Bartosz Sypytkowski
@Horusiath
Dec 18 2018 06:59

if I create a persistent actor from scratch, does it go to database on its recovery phase ?

@OnurGumus by default, yes.

Onur Gumus
@OnurGumus
Dec 18 2018 07:11
@Horusiath This is actually causing an issue for me. My Event Journal table contains millions of records. It is inefficient to go to database whenever I create a brand new persistent actor.
What can I do about it ?
by checking ToSequenceNr == 0
Onur Gumus
@OnurGumus
Dec 18 2018 07:37
@Horusiath and regarding that do you think extending FunPersistentActor as below is ok?
type FunPersistentActor2<'Message>(actor : Eventsourced<'Message> -> Effect<'Message>, recovery)  =
    inherit  FunPersistentActor<'Message>(actor)
    override __.Recovery  = recovery

let propsPersist2 (receive: Eventsourced<'Message> -> Effect<'Message>, recovery) : Props<'Message> =

        Props<'Message>.ArgsCreate<FunPersistentActor2<'Message>, Eventsourced<'Message>, 'Message>([|receive,recovery|])
joowon
@HIPERCUBE
Dec 18 2018 07:49

@angrybug Here is my configuration

I tried both of them

Bartosz Sypytkowski
@Horusiath
Dec 18 2018 10:10
@OnurGumus it was originally created so that you don't need to think if actor is new or not (how would you know it, if a machine can crash)
Peter Huang
@angrybug
Dec 18 2018 11:15
@HIPERCUBE had another look at your first snippet, have you try adding await/Wait()
Ilya Komendantov
@IlyaKomendantov_twitter
Dec 18 2018 11:22

Hey guys,
The situation:

  1. Players have inventory with items
  2. Shops have the same items
  3. Items have different parameters
    The parameters of the item can change.

How to store this data correctly?

I'm going to store only Guid and amount of the item
Also I'm going to have a Resolver that keeps the description of each item (by Guid)
But everytime when player is asked about item, it needs to resolve it first (the same for shops). This will probably create a huge load for Resolver..
I can create a PersistentActor for each item with the PersistentId = Guid. Then I can get this actor by Context.ActorSelection("../Guid") , how about performance here?
The projections can be used, but the parameters of the item I need in a lot of different places, will this work?

Can you suggest the best practice for such scenario?

Peter Huang
@angrybug
Dec 18 2018 11:54
@HIPERCUBE the using block kills the materializer before it has a chance to run.
Onur Gumus
@OnurGumus
Dec 18 2018 12:10
@Horusiath just in case will my above code work for akkling?
Aaron Stannard
@Aaronontheweb
Dec 18 2018 16:25
@/all Akka.NET v1.3.11 is now live on NuGet https://twitter.com/AkkaDotNET/status/1075064280804925442
@HIPERCUBE having some trouble following all of the threads in Gitter chat here - I'd be happy to help though. Would you mind opening a Github issue with all of this in a single thread?
that'd be really helpful for me!