akka.net

Passing Contextual Information

强颜欢笑 提交于 2021-01-28 14:41:36
问题 We are in the process of adding akka.net actors to part of a legacy system. The basic idea is that a message comes in from an external system, it is handed off to a logic that is managed by akka.net actors which then talk to legacy components that do things like save data to the database. The legacy code relies on the fact that a userId is set in the CallContext, which it can then retrieve before doing database writes (to store things like "CreatedBy" and "LastModifiedBy"). It seems clear

How to include Akka.net framework for F# in VSCode

孤街浪徒 提交于 2020-12-26 08:22:09
问题 I am trying to use Akka.NET for F# in VSCode using this example I found on the internet. Code // ActorSayHello.fsx #time "on" // #load "Bootstrap.fsx" open System open Akka.Actor open Akka.Configuration open Akka.FSharp open Akka.TestKit // #Using Actor // Actors are one of Akka's concurrent models. // An Actor is a like a thread instance with a mailbox. // It can be created with system.ActorOf: use receive to get a message, and <! to send a message. // This example is an EchoServer which can

.Net中DLL冲突解决(真假美猴王)

☆樱花仙子☆ 提交于 2020-04-23 02:40:32
《西游记》中真假美猴王让人着实难以区分,但是我们熟知了其中的细节也不难把他们剥去表象分别出来。对问题不太关心的可以直接调到文中关于 .Net文件版本的介绍 问题 最近在编译AKKA.net 时出现了一个问题: Newtonsoft.Json.dll 冲突. C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): warning MSB3243: No way to resolve conflict between " Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed " and " Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed ". Choosing "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily. Consider app.config remapping of assembly

Getting Akka.NET to connect to a remote addresses

拈花ヽ惹草 提交于 2020-01-24 07:49:22
问题 All the demos I have found showing how to get started with remoting in Akka.NET demonstrate the simplest use case where the two actors are running on the same machine using localhost. I am trying to get an Akka.NET actor to connect to a remote machine and have run into some difficulty. The code is extremely simple: Client Code : var config = ConfigurationFactory.ParseString(@" akka { log-config-on-start = on stdout-loglevel = DEBUG loglevel = DEBUG actor { provider = ""Akka.Remote

Can I Read/Write from separate actors with same PersistenceId?

馋奶兔 提交于 2020-01-07 03:40:29
问题 The Petabridge blog's Akka.Persistence intro makes it clear that you can't have multiple actors with the same PersistenceId: The PersistenceId field is important - it uniquely identifies an entity that is persisting its state using Akka.Persistence, and there should be exactly one persistent actor at any given time for a single PersistenceId . [...] so imagine if you have two actors with the same PersistenceId but different sequence numbers writing to the same store. It will be chaos and will

Akka.Net Streams - Source stops pulling elements when buffer throws error

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 05:15:30
问题 I've been playing a little with the streams extension package for Akka.Net and noticed this error at attempting to combine buffer and throttle methods: using (var system = ActorSystem.Create("test-system")) using (var materializer = system.Materializer(GetSettings(system))) { int index = 0; var sink = Sink.ActorRefWithAck<KeyValue>( system.ActorOf<Writer>(), new OnInitMessage(), new OnAcknowledgeMessage(), OnComplete.Instance, exception => new OnError(exception)); ServiceBusSource .Create

How to implement custom routing in Akka.Net

不羁岁月 提交于 2020-01-03 06:27:13
问题 Akka.Net provides a number of usefull routing strategies out of the box (we currently use smallest mailbox and consistent hashing), but what if want to implement custom router with strategy based on let's call it Worker Node Load Index which is will be calculated separetly on each node based on current resource consumption. I could not find docs or examples regarding this topic, so any info is higly appreciated. Thanks 回答1: You can create your own routing strategy by deriving from the base

Why do I get a DeathWatchNotification of an undelivered message on shutdown?

强颜欢笑 提交于 2019-12-25 11:57:53
问题 Why do a get a DeathWatchNotification when running this console app: class Program { private static ActorSystem TestSystem; static void Main(string[] args) { TestSystem = ActorSystem.Create("TestSystem"); TestSystem.ActorOf<TestActor>("Test"); Console.WriteLine("Press a key to shutdown actor system"); Console.ReadKey(); TestSystem.Shutdown(); TestSystem.AwaitTermination(); Console.WriteLine("Press a key to quit"); Console.ReadKey(); } } public class TestActor : ReceiveActor { public TestActor