These are chat archives for akkadotnet/akka.net

8th
Dec 2017
ForrestWang
@ForrestWang
Dec 08 2017 09:50

Hi, we use Akka.net for a while in our production environment already. recently, we are looking at Akka.net streams, and I have a question about it.

Let's say I have an Order class.

class Order {
public string OrderID {get;set;}
...
}

the logic is, we collect a bunch of orders and transform, save to database, a typically ETL process.

the prototype could be like this:

List<Order> orders = new List<Order>();

orders.add(new Order("orderID1"));
orders.add(new Order("orderID2"));

Source.From(orders).select(x=>x.OrderID = x.OrderID + "123").RunForeach(Console.WriteLine());

After that, obviously, the original order collection, each order's ID has _123 appended, so my question is, through each flow, should I create a new instance of Order and transform on the new instance, then pass the new one to the next flow, in other words, keep the original collection element immutable.

Bart de Boer
@boekabart
Dec 08 2017 10:48
Yes, 1000 times yes. Just make it a habit to make your 'message' classes/structs immutable (so, eg. no {get; set;} , just { get; } and constructor setting.
Paweł Bańka
@pmbanka
Dec 08 2017 12:24

Hi! I have a problem with clustering. I have 2 nodes which use sharding, and some lighthouses. After I restarted the nodes, they joined the cluster without issues, but the sharded actors cannot be spawned. The errors I get look like this:

Trying to register to coordinator at ["/system/sharding/ps_filesCoordinator/singleton/coordinator"], but no acknowledgement. Total [1600] buffered messages.

And there is a ton of them spamming all the time. The root cause seems to be related to restoring state of shard coordinator

{
  "Depth": 0,
  "ClassName": "System.ArgumentException",
  "Message": "Region [akka://Oddjob/system/sharding/ps_files#1292415200] not registered\r\nParameter name: e",
  "Source": "Akka.Cluster.Sharding",
  "StackTraceString": "   at Akka.Cluster.Sharding.PersistentShardCoordinator.State.Updated(IDomainEvent e)\r\n   at Akka.Cluster.Sharding.PersistentShardCoordinator.ReceiveRecover(Object message)\r\n   at Akka.Persistence.Eventsourced.<RecoveryStarted>b__90_0(Object message)\r\n   at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)\r\n   at Akka.Persistence.Eventsourced.<>c__DisplayClass92_0.<Recovering>b__0(Receive receive, Object message)",
  "RemoteStackTraceString": null,
  "RemoteStackIndex": 0,
  "ExceptionMethod": {
    "Name": "Updated",
    "AssemblyName": "Akka.Cluster.Sharding",
    "AssemblyVersion": "1.3.2.0",
    "AssemblyCulture": "",
    "ClassName": "Akka.Cluster.Sharding.PersistentShardCoordinator+State",
    "Signature": "State Updated(IDomainEvent)",
    "MemberType": 8
  },
  "HResult": -2147024809,
  "HelpURL": null
}


Exception in ReceiveRecover when replaying event type ["Akka.Cluster.Sharding.PersistentShardCoordinator+ShardHomeAllocated"] with sequence number [8] for persistenceId ["/system/sharding/ps_filesCoordinator/singleton/coordinator"]

The wierd thing is that it fails on sequence number 8 when there is 21 entries in the DB.

Any pointers on what could be the cause of the error here? I don't understand what "Region not registered" means :|

(I know that I can probably fix it by purging the DB, but I'd like to understand why is it happening).