Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 10:47
    IgorFedchenko synchronize #3973
  • 10:13
    valdisz commented #3921
  • Oct 21 15:57
    Aaronontheweb closed #3877
  • Oct 21 15:57
    Aaronontheweb commented #3877
  • Oct 21 15:56

    Aaronontheweb on dev

    Persistence TestKit documentati… (compare)

  • Oct 21 15:56
    Aaronontheweb closed #3889
  • Oct 21 07:27
    dependabot-preview[bot] labeled #3999
  • Oct 21 07:27

    dependabot-preview[bot] on nuget

    Bump FluentAssertions from 4.14… (compare)

  • Oct 21 07:27
    dependabot-preview[bot] opened #3999
  • Oct 20 17:25
    valdisz synchronize #3889
  • Oct 20 17:17
    valdisz synchronize #3889
  • Oct 20 15:44
    valdisz synchronize #3889
  • Oct 20 09:22
    ismaelhamed commented #3863
  • Oct 19 23:39
    valdisz synchronize #3889
  • Oct 19 23:08
    edvinasz commented #2947
  • Oct 19 13:36
    Aaronontheweb commented #3973
  • Oct 19 13:34
    dependabot-preview[bot] synchronize #3995
  • Oct 19 13:34

    dependabot-preview[bot] on nuget

    Bump BenchmarkDotNet from 0.10.… (compare)

  • Oct 19 13:34
    dependabot-preview[bot] edited #3995
  • Oct 19 13:34
    dependabot-preview[bot] synchronize #3993
Andrew Skotzko
@skotzko
s/them/the messages
Daniel Ferreira Monteiro Alves
@danfma
that's what the monitor is doing the previous code
the Executors is a pool of actors routed by the monitor
Andrew Skotzko
@skotzko
ah
ok
Daniel Ferreira Monteiro Alves
@danfma
one thing is funny
if I use the async from the .NET then the actors does not respect the default behaviour that only one message is processed by an actor at a time, apparenly
apparently*
is the the right thing when using async or a problem
Roger Johansson
@rogeralsing
What version are you using?
Daniel Ferreira Monteiro Alves
@danfma
the last one
just checking
Andrew Skotzko
@skotzko
default respects one message at at time
Roger Johansson
@rogeralsing
And what async behavior? Suspend or reentrant?
Natan Vivo
@nvivo
this async stuff must be a problem with Brazilians...
Andrew Skotzko
@skotzko
you have to specifically enable reentrant
Daniel Ferreira Monteiro Alves
@danfma
the version on nuget is the 1.0.0
yes, I configured that
kkkkkkkkkkkkk
is there another one here?
Natan Vivo
@nvivo
you should leave the default or specify Suspend
are you using ReceiveActor?
Daniel Ferreira Monteiro Alves
@danfma
yes
I will write one example here, just a moment
Natan Vivo
@nvivo
just do Receive<Foo>(async foo => { .. })
the default behavior is Suspend already
Roger Johansson
@rogeralsing
Btw async await is broken in nuget 1.0 package
Natan Vivo
@nvivo
oh, right!
Andrew Skotzko
@skotzko
but fix coming next week
in 1.0.1
Daniel Ferreira Monteiro Alves
@danfma
ahhhh
Natan Vivo
@nvivo
@danfma I'm Brazilian
Daniel Ferreira Monteiro Alves
@danfma
:D
me too
and good to say that was not a problem with me this time
:D
public class JobExecutor : ReceiveActor
    {
        private readonly Application _application;
        private bool _working = false;

        public JobExecutor(Application application)
        {
            _application = application;

            Receive<BeginWork>(AsyncBehavior.Reentrant, _ => _application.ExecuteInScope(() => OnBeginWork()));
        }

        private async Task OnBeginWork()
        {
            if (_working)
            {
                Console.WriteLine("Executando trabalho ainda {0}", Thread.CurrentThread.ManagedThreadId);
                return;
            }

            _working = true;

            Console.WriteLine("Iniciando trabalho {0}", Thread.CurrentThread.ManagedThreadId);
            //Thread.Sleep(8000);
            await Task.Delay(10000);
            Console.WriteLine("Finalizando trabalho {0}", Thread.CurrentThread.ManagedThreadId);

            _working = false;
        }
    }
Natan Vivo
@nvivo
Reentrant means exactly that messages will be processed during task awaits
you want the non-reentrant behavior
Andrew Skotzko
@skotzko
yeah you want the suspend behavior
Daniel Ferreira Monteiro Alves
@danfma
if I use the suspend the message will be processed only one time
Natan Vivo
@nvivo
Yes, and that's the default, you don't need to provide an argument
Andrew Skotzko
@skotzko
Daniel Ferreira Monteiro Alves
@danfma
ok I will check
Natan Vivo
@nvivo
out of curiosity, what is that Application you have there? Are you executing that code somewhere else?
Daniel Ferreira Monteiro Alves
@danfma
I created an instance of my app, which starts the windsor and others services, so that application is where my services are
Natan Vivo
@nvivo
You can use DI with akka, there are some docs with that
and as a general rule, you should never touch actor state from threads other than what the actor is running on
Daniel Ferreira Monteiro Alves
@danfma
yes, I know, I will check that too, I just want to use quickly here to test
Natan Vivo
@nvivo
right