by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 17:18
    Arkatufus synchronize #4425
  • Aug 08 10:17
    Zetanova edited #4533
  • Aug 07 23:32

    dependabot-preview[bot] on nuget

    (compare)

  • Aug 07 23:32

    dependabot-preview[bot] on dev

    Bump Microsoft.NET.Test.Sdk fro… (compare)

  • Aug 07 23:32
    dependabot-preview[bot] closed #4538
  • Aug 07 22:00
    Arkatufus synchronize #4531
  • Aug 07 19:27
    dependabot-preview[bot] commented #4538
  • Aug 07 17:52
    dependabot-preview[bot] edited #4538
  • Aug 07 17:52
    Aaronontheweb commented #4538
  • Aug 07 17:52
    dependabot-preview[bot] synchronize #4538
  • Aug 07 17:52
    dependabot-preview[bot] synchronize #4337
  • Aug 07 17:52

    dependabot-preview[bot] on nuget

    Bump Microsoft.NET.Test.Sdk fro… (compare)

  • Aug 07 17:52

    dependabot-preview[bot] on nuget

    Bump FSharp.Quotations.Evaluato… (compare)

  • Aug 07 17:52
    dependabot-preview[bot] edited #4538
  • Aug 07 17:52
    dependabot-preview[bot] edited #4337
  • Aug 07 17:50
    dependabot-preview[bot] edited #4538
  • Aug 07 17:50
    dependabot-preview[bot] edited #4337
  • Aug 07 17:50

    Aaronontheweb on dev

    Enhance OpenCircuitException er… (compare)

  • Aug 07 17:50
    Aaronontheweb closed #4534
  • Aug 07 17:50
    Aaronontheweb closed #4314
v1rusw0rm
@v1rusw0rm
Exactly.
matneyx
@matneyx
Awesome, thank you
And, considering my usage, I think you're right... Tell is going to be a better option.
v1rusw0rm
@v1rusw0rm
Tell is always better in performance-wise cases.
Good article, explaining when to use Ask: https://bartoszsypytkowski.com/dont-ask-tell-2/
Shukhrat Nekbaev
@snekbaev
Hi, question about .ConfigureAwait(false):
in ctor: ReceiveAsync<RequestAllInstances>( HandleRequestAllInstancesAsync );
method:
private async Task HandleRequestAllInstancesAsync( RequestAllInstances msg )
{
    var sender = Sender;

    var list = new List<A> { new A(), new A(), new A() };

    await Task.Delay( 10000 ).ConfigureAwait( false );

    // Sender.Tell( new RespondAllInstances( list.AsReadOnly() ) ); <-- this is going to crash with missing ActorContext
    sender.Tell( new RespondAllInstances( list.AsReadOnly() ) ); // but if saved beforehand then it's ok
}
actor system host app: regular console application
What is the general recommendation regarding the awaited tasks and captured context? Should I keep doing as in example above, i.e. capture context specific variables beforehand or should I switch to .ConfigureAwait(true)?
Sam13
@Sam13

@Danthar Thanks for your help. I ended up with something like that:

public FileManager()
{    
    m_fileTransferQueue = Source.Queue<Tuple<FileTransferStart, IActorRef>>(25, OverflowStrategy.Backpressure).To(Sink.ForEach<Tuple<FileTransferStart, IActorRef>>(DoProcess)).Run(Context.Materializer());
}

protected override void PostStop()
{
    base.PostStop();
    m_fileTransferQueue.Complete();
}

private void OnReceive(FileTransferStart fileTransferStart)
{
    m_fileTransferQueue.OfferAsync(new Tuple<FileTransferStart, IActorRef>(fileTransferStart, Sender));    
}

private void DoProcess(Tuple<FileTransferStart, IActorRef> fileTransferStart)
{
    var fileInfo = new FileInfo(Path.Combine(m_directory, fileTransferStart.Item1.FileName));
    var transferTask = FileIO.FromFile(fileInfo).Via(Flow.Create<ByteString>().Select(x => x.ToArray())).To(Sink.ActorRef<byte[]>(fileTransferStart.Item2, new FileTransferFinished())).Run(Context.Materializer()).ContinueWith(x =>
    {
        if (!x.Result.WasSuccessful)
        {
            Logger.ErrorException("Error during file transfer", x.Result.Error);
        }
    });
    // Run synchronous to have only 25 active items in queue?
    transferTask.Wait();
}

Is it correct that the processing of the file must run synchronous to ensure only 25 items are processed at the same time?

Arjen Smits
@Danthar
What the ForEach sink does. is it takes an item from the stream, runs its action, and takes the next. If your action is async, it will not block, and thus keep taking the next item. So yes, in this configuration. you would have to run your action syncronous.
Arjen Smits
@Danthar
@Sam13 take a look at the SelectAsync operator
And for more context and samples: https://getakka.net/articles/streams/integration.html
Sam13
@Sam13
@Danthar Ok thanks, just want to make sure I understood everything correctly. I'll have a look at that!
Vasily Kirichenko
@vasily-kirichenko
@Sam13 why do you not use struct tuples?
Bruno Alencar
@bruno-alencar

Can anyone help me?

I'm looking for a way to combine Rest API with Akka.net in a Cluster System. I would not connect the rest api receiver inside the cluster,
but sending messages for the cluster group.
I saw something about recepcionist, but when I tried to use inside the lighthouse system, It occurred exception because it was required that
know all messages types.

Is there any way to use these things together with best performance?

Sam13
@Sam13
@vasily-kirichenko I'm still on .NET 4.6.1, ValueTuple was introduced in 4.7
AndreSteenbergen
@AndreSteenbergen
Guys, what do you think? I created an Unbounded ---Stable--- PriorityQueue. Is this Gist worthy of creating a Pull Request to fix: akkadotnet/akka.net#2652
nathvi
@nathvi
@AndreSteenbergen , I would change Seqnum to SequenceNumber
If you're going to name that Func priorityCalculator instead of priorityCalc, might as well be equally verbose.
nathvi
@nathvi
Also I'd change the line:
var ci = _data.Count - 1; // child index; start at end
To something like:
var endChildIndex = _data.Count - 1;
@AndreSteenbergen
AndreSteenbergen
@AndreSteenbergen
I am actually not so much inclined to change that code, as it is a straight copy from the ListPriorityQueue from akka.net sources on github
seqnum and priorityCalc yes, I think you are correct.
nathvi
@nathvi
If you have to add a comment to explain what the intention of the statement is, then the variable names are poor.
Not always, but in this case, I think having a more explicit name for the var would be much better than littering the code with comments.
AndreSteenbergen
@AndreSteenbergen
I understand what you are saying. my goal here was to keep as close to original source as I could, but changing the functionality in such a way we can end up with a priority queue with correct order.
nathvi
@nathvi

if (rci <= li && comparator.Compare(_data[pi],_data[rci]) > 0) return false; // check the right child too.

The entire check inside of the if should be a single bool variable. The comment just confuses things.
Code never lies. Comments sometimes do.

If you can make code more readable, do it. We spend at least 90% of our time reading code. Not writing it.
AndreSteenbergen
@AndreSteenbergen
This is my original source:
I understand what you are saying, but I am still not inclined to change copied stuff, when there is proven code, as in don't fix if it ain't broken.
nathvi
@nathvi
It's not "broken" as in the functionality works, but it's "broken" in that it's not as clean as it could be.
I think it's worth cleaning up the code if it makes understanding it easier.
AndreSteenbergen
@AndreSteenbergen
ok
nathvi
@nathvi
If I had a 2000 line function that was nested 8 levels deep and passed all my unit tests, it's probably still worthless as far as being composable or understandable by other people. This is an extreme case, but I think you get me.
AndreSteenbergen
@AndreSteenbergen
From the comment you made I understood you ;)
nathvi
@nathvi
:)
nathvi
@nathvi
omfg
} // ListPriorityQueue
Comments like this really irk me.
AndreSteenbergen
@AndreSteenbergen
little too much copy paste I guess. ;)
nathvi
@nathvi
GAH!
AndreSteenbergen
@AndreSteenbergen
I see it is 4 year old code I copied over ;) @rogeralsing made the commits for the PriorityQueue
nathvi
@nathvi
DAMN YOU! lol
AndreSteenbergen
@AndreSteenbergen
I removed the closing tag comments ;) and seqnum is now SequenceNumber ;)
nathvi
@nathvi
:)
Alex Hofer
@alexhofer

Hey all, I am running into some weird issues with Docker and clustering. My cluster works perfectly fine outside of Docker, but while running in docker I get association errors after about 15 seconds of it being up. Before this Lighthouse shows both nodes as being welcomed to the cluster and moving to up. After that nothing happens out of the ordinary on the nodes, they just start throwing association errors:

**From Lighthouse**
[INFO][07/05/2018 16:29:59][Thread 0019][[akka://hub-system/system/cluster/core/daemon#107465231]] Leader can currently not perform its duties, reachability status: [Reachability([akka.tcp://hub-system@localhost:26100 -> UniqueAddress: (akka.tcp://hub-system@localhost:26800, 1690450065): Unreachable [Unreachable] (1)][akka.tcp://hub-system@localhost:26800 -> UniqueAddress: (akka.tcp://hub-system@localhost:26100, 1417053438): Unreachable [Unreachable] (1)])], member status: [$akka.tcp://hub-system@lighthouse:4053 $Up seen=$True, $akka.tcp://hub-system@localhost:26100 $Up seen=$False, $akka.tcp://hub-system@localhost:26800 $Up seen=$False]

**From a Node**
[Akka.Remote.EndpointWriter] [WARN] : AssociationError [akka.tcp://hub-system@localhost:26100] -> akka.tcp://hub-system@localhost:26800: Error [Association failed with akka.tcp://hub-system@localhost:26800] []
[remoting] [WARN] : Tried to associate with unreachable remote address [akka.tcp://hub-system@localhost:26800]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters. Reason: [Association failed with akka.tcp://hub-system@localhost:26800] Caused by: [System.AggregateException: One or more errors occurred. (Connection refused tcp://hub-system@localhost:26800) ---> Akka.Remote.Transport.InvalidAssociationException: Connection refused tcp://hub-system@localhost:26800

Has anyone else run into this?

matneyx
@matneyx

What's the proper way to grab an IActorRef for other Actors within the same system?

I'm initializing my ConsoleWriterActor immediately after starting up the Actor system, inside the Main method of my command line program

static void Main(string[] args) {
            _actorSystem = ActorSystem.Create("FileWatcherActorSystem");
            _consoleWriter = _actorSystem.ActorOf<ConsoleWriterActor>("consoleWriter");

And then I'm trying to grab that same actor two children deep, in the first Actor that needs to actually write anything.

_consoleWriter = Context.System.ActorSelection("consoleWriter").Anchor;

But when I try to Tell the consoleWriter anything, I get info about a dead letter...

I've also tried this using the absolute and relative paths to the consoleWriter.

Alex Hofer
@alexhofer
Is that an actor you will be sending messages to from all over?