Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 15 15:46
    SeanKilleen synchronize #5324
  • Oct 15 02:59
    SeanKilleen commented #5312
  • Oct 14 21:36
    sean-gilliam commented #5312
  • Oct 14 17:30
    SeanKilleen edited #5312
  • Oct 14 17:30
    SeanKilleen edited #5312
  • Oct 14 17:29
    SeanKilleen edited #5312
  • Oct 14 17:28
    SeanKilleen edited #5312
  • Oct 14 17:28
    SeanKilleen edited #5312
  • Oct 14 17:27
    SeanKilleen edited #5312
  • Oct 14 17:26
    SeanKilleen edited #5312
  • Oct 14 17:25
    SeanKilleen edited #5312
  • Oct 14 17:23
    SeanKilleen edited #5312
  • Oct 14 17:22
    SeanKilleen edited #5312
  • Oct 14 16:57
    SeanKilleen synchronize #5324
  • Oct 14 16:26
    SeanKilleen edited #5312
  • Oct 14 16:26
    SeanKilleen opened #5324
  • Oct 14 16:04
    SeanKilleen edited #5312
  • Oct 14 15:58
    SeanKilleen edited #5312
  • Oct 14 15:58
    SeanKilleen opened #5323
  • Oct 14 15:46
    SeanKilleen edited #5312
Aaron Stannard
@Aaronontheweb
so even if we could pass in the constructs for pooling, re-using memory, we couldn't get the damn libraries to use them
I haven't paid much attention to JSON.NET, but I know that Protobuf finally has some decent support for this
other problem we've run into: it's not very safe to pool inside Akka.NET. No discrete lifetime to memory objects, given how asynchronous the processing is once they exit Akka.Remote
so that makes pooling quite hard in practice
Markus Schaber
@markusschaber
As far as I can see, System.Text.JSON also has decent support. So that might be an alternative for JSON.NET.
JSON.NET can work with streams, and MemoryStream can work on pre-allocated buffers.
gerardpeters
@gerardpeters

Hi guys, I'm having trouble to get akka.net running on k8s. I'm using ddata for sharding but got the following error:
Failed to store ["shard-ConsignmentActor-185-0"]:"System.DllNotFoundException: Unable to load shared library 'lmdb' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblmdb: cannot open shared object file: No such file or directory at LightningDB.Native.LmdbMethods.mdb_env_create(IntPtr& env) at LightningDB.Native.Lmdb.mdb_env_create(IntPtr& env) at LightningDB.LightningEnvironment..ctor(String path, EnvironmentConfiguration configuration) at Akka.DistributedData.LightningDB.LmdbDurableStore.GetLightningEnvironment() at Akka.DistributedData.LightningDB.LmdbDurableStore.<Active>b__17_0(Store store) at lambda_method36(Closure , Object , Action`1 , Action`1 ) at Akka.Tools.MatchHandler.PartialHandlerArgumentsCapture`3.Handle(T value) at Akka.Actor.ReceiveActor.<>c__DisplayClass11_0.<Become>b__0(Object m) at Akka.Actor.ActorCell.<>c__DisplayClass114_0.<Akka.Actor.IUntypedActorContext.Become>b__0(Object m) at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message) at Akka.Actor.ActorCell.ReceiveMessage(Object message) at Akka.Actor.ActorCell.Invoke(Envelope envelope)"

Any idea's? I'm running the latest version of akka on .net 5.

3 replies
Pranjal Mathur
@pranjalmathur

image.png

Hi, I was trying to use Akka.DistributedData, however getting this error while trying it out.

Fabio Catunda Marreco
@fabiomarreco

Hello, everyone, I have a question that probably someone has already stumbled upon. I am reading messages to an entity from a Kafka cluster into a AkkaClusterSharding. There is a Kafka consumer in each Akka Cluster node. By leaving Kafka with default partition assignment strategy & Akka with default Shard allocation strategy, I will probably add an unnecessary network hop between the consumer & the entity. Also it is not very safe since a node failure might affect entities unrelated its shard assignment.

So what is the recommended pattern in this situation ?

5 replies
Aaron Stannard
@Aaronontheweb
@pranjalmathur the replicator is internal but you shouldn't need access to that message as that's also meant to be internal. What were you trying to accomplish?
Kamil Wojciechowski
@aph5nt
Hi guys, when can we expect akka to be ready for .net 5+ ?
David Mercer
@dbmercer
Does anyone create interfaces for their actors? I'm new to Akka.Net, but started doing something like this:
public sealed class ImageProviderActorInterface : ActorInterface
{
    public ImageProviderActorInterface( IActorRef actor ) : base( actor ) { }

    public void RequestImage() => Actor.Tell( new ImageRequest() );

    public async Task<Either<NoMoreImagesNotification, RequestedImage>> RequestImageAsync( TimeSpan? timeout = null )
    {
        return await Actor.Ask( new ImageRequest(), timeout )
            switch
            {
                NoMoreImagesNotification x => Either.Left( x ),
                RequestedImage x => Either.Right( x )
            };
    }
}
I also have an extension method thus:
public static partial class ActorInterfaceExtensions
{
    public static ImageProviderActorInterface AsImageProvider( this IActorRef actor ) => new(actor);
}
Now when I get an actor ref that I know is an image provider, I store it as actorRef.AsImageProvider().
And I can send an image request with imageProvider.RequestImage() or imageProvider.RequestImageAsync().
Thoughts on this approach?
Arjen Smits
@Danthar
@aph5nt im using Akka.Net inside an netcore5 system in production right now. No problem
Sindre Alstad Wilting
@woksin
What happens when doing ActorOf on ActorSystem that ultimately resolved to the ActorPath of an already created actor? Does
Does it return the IActorRef of the already created actor?
David Mercer
@dbmercer
@woksin If the name already exists, you get an error.
Michael Handschuh
@mchandschuh

Consider a single stream of events. Each event belongs to a topic and has a sequence number. Sequences within a topic are guaranteed to be monotonic and continuous. I'm looking for a stream topology that allows subscribers to dynamically bind to topic specific sub-streams. If there's no subscribers then events can simply be dropped (Sink.Ignore<T>() works). Subscribers need to be able to gracefully disconnect from the topic sub-stream w/out affecting the rest of the running graph.

I think one way of doing this is to use GroupBy to produce sub-streams. I could then add a Broadcast to each sub-stream and by default add a Sink.Ignore<T>() to keep it drained. When a subscription for the topic comes in I could materialize a source from the Broadcast to dynamically add the consumer. For the purposes of this question, let's ignore issues caused by consumers processing messages at different rates as we already have a solution that addresses this. I think this runs into issues since GroupBy sub-streams never die IIRC. Ideally there would be a mechanism for retiring the processing pipeline for a particular topic that is guaranteed to never receive anymore events. All future consumers of the topic would simply replay from a persistent store.

My reluctance to use GroupBy is that it just doesn't seem like the right tool for the job. For some reason I feel like the PartitionHub is really what I want, but there's no way to track metadata on a per consumer basis that I'm aware of, or for the partitioner function to be notified of when consumers are added. I suppose a custom hub implementation could do the job, but that seems like overkill and would involve unnecessary implementation risks as well as implementing my own source materialized value to capture the consumer metadata (assuming I understand things correctly which is a BIG assumption!).

Another possible solution is to define an implementation of EventBus<TEvent, TClassifier, TSubscriber> that uses topic strings as the classifier. With this approach, publishing to subscribers is as simple as a Select(evt => bus.Publish(evt)). Inside the bus each TSubscriber could be a stream w/ a Source.Queue<TEvent> piping into a Broadcast and when someone subscribes to a topic, simply materialized the broadcast source which can then be used to feed the consumers processing pipeline. Leaning on the EventBus type here feels like I'm going against the grain of streams by not using a built-in stage for handling this fan-out to dynamic consumers. A plus side here is error isolation as it can't propagate through the event bus. We have a separate mechanism in place for handling replies/acks/confirms/processing errors/etc.

Thoughts?

Markus Schaber
@markusschaber

We're currently evaluating Akka.NET, and another team in our company therefore became aware of Akka.NET. They want to be able to "transparently" (whatever that exactly means) decide which code runs on the server and which code runs on the client (using client side blazor aka compiling .NET to WebAssembly). Security needs to be maintained as the clients are different users which potentially trust each other.

Is something like that generally thinkable using Akka.NET, maybe using Akka.Remoting with a custom protocol over websocket, or by using Akka.IO and "proxy actors" which forward and filter messages?

Sindre Alstad Wilting
@woksin
@Aaronontheweb Akka under the hood seems to spin up threads and run in the execution context of those threads when for instance creating actors. I have a problem where our system has an ExecutionContextManager with an AsyncLocal of our custom ExecutionContext object, I see that when the actor system actually gets to creating some of the actors I've told it to create the AsyncLocal ExecutionContext seems to be not in an expected state. Is it possible to hook in somewhere to make sure that I can set the value of this AsyncLocal to something before it gets to create the actors through the props? The reason I need this is because we have customized AutoFac to inject dependencies scoped as singletons per tenant and the tenant is derieved from our ExecutionContextManager's AsyncLocal ExecutionContext. I see in the debugger that when the actor systems tries to create some of the actors that needs tenant-bound dependencies that our ExecutionContext is never set. Could I do something with registering an IExtension to the ActorSystem? Or maybe I have to make a custom IActorRefProvider?
Sindre Alstad Wilting
@woksin
I just found Props.CreateBy and IIndirectActorProducer, that sounds like the thing I want. Does that sound right?
Manuel Islas
@trentcioran
Hi All,
I have a use case in which I need to process data from different sources, each needs to be expanded into its components, it is not a stream but more of a finite amount of work, composed of different stages of processing: text extraction or OCR if applicable, pre-processing, indexing for full-text-search, containerization of the extracted texts, transformation into HTML for display, etc. Items (files) expanded can change over time so I need to detect changed items and re-process them.
Something I don't see support for and that is the reason that I started to question the use of Akka.net is that I want to batch some of the expanded items, I can't process all at once as it could be on the tens of thousands per source, so it is not practical and better to work over multiple actors but would be best to batch this work so indexing is more efficient.
I have been reading the docs and build a prototype but feels like I might be over-complicating things, I would appreciate your feedback whether should I continue this path (akka.net) or should use something else.
I really appreciate your feedback and experience with Akka providing some light here. Thanks.
Aaron Stannard
@Aaronontheweb
@woksin sorry for the delay - was out last week on a brief paternity leave
I just found Props.CreateBy and IIndirectActorProducer, that sounds like the thing I want. Does that sound right?
@trentcioran that sounds like a great use case for Akka.Streams IMHO
a higher level abstraction on top of Akka.NET actors
which uses a LINQ-like syntax
to perform things like batching, debouncing, filtering, etc
Aaron Stannard
@Aaronontheweb
we have multiple users who use Akka.NET for this purpose BTW
I recall one in particular who built a large pre-processing system for managing massive Elastic indexing workloads
so you're in good company
Aaron Stannard
@Aaronontheweb
@markusschaber so running Akka.NET inside Blazor isn't really possible on the client side
due to WASM being single-threaded and restricting access to lots of primitives Akka.NET depends on (i.e. most synchronization mechanisms)
it can run fine in Blazor server mode though - done that here: https://github.com/petabridge/DrawTogether.NET
Is something like that generally thinkable using Akka.NET, maybe using Akka.Remoting with a custom protocol over websocket, or by using Akka.IO and "proxy actors" which forward and filter messages?
so this is what we do with things like https://cmd.petabridge.com/
it's all done via Akka.IO
with a strictly controlled serialization format to restrict access to what the client can do
we'll eventually introduce ACL and TLS to that
I think that approach is pretty feasible - the other approach would be to use something like Akka.gRPC (when we port it) to use gRPC as a secure gateway for invoking Akka.NET actors behind the scenes
Robbert
@Robbert-Driven-It
I hope someone here can point me in the right direction. I’ve been experimenting with clusters and the clusterclient. I’m able to communicate with a cluster from an external actor system however the clusterclient doesn’t seem to “fail over” when the cluster loses a node. My expectation was that the clusterclient would automatically keep track of new nodes (running a duplicate console app with a dynamic port) and would start sending messages there once the initial contact node has gone down… Am I mistaken, do I need to manually keep track of nodes?
Aaron Stannard
@Aaronontheweb
My expectation was that the clusterclient would automatically keep track of new nodes (running a duplicate console app with a dynamic port) and would start sending messages there once the initial contact node has gone down… Am I mistaken, do I need to manually keep track of nodes?
ClusterClient does automatically keep track of available nodes