by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 08:13
    ismaelhamed opened #4513
  • Jul 11 20:19
    to11mtm commented #4419
  • Jul 11 20:13
    to11mtm opened #161
  • Jul 11 05:28
    srinivasrb closed #4501
  • Jul 11 05:28
    srinivasrb commented #4501
  • Jul 11 01:12
    to11mtm opened #4512
  • Jul 10 23:43
    Arkatufus commented #4511
  • Jul 10 23:36
    Arkatufus commented #4506
  • Jul 10 23:36
    Arkatufus closed #4506
  • Jul 10 23:35
    Arkatufus commented #4511
  • Jul 10 23:29
    Arkatufus edited #4511
  • Jul 10 23:29
    Arkatufus converted_to_draft #4511
  • Jul 10 23:28
    Arkatufus opened #4511
  • Jul 10 09:45
    petrikero opened #4510
  • Jul 10 09:17
    petrikero opened #4509
  • Jul 10 07:33
    ismaelhamed commented #4419
  • Jul 10 05:25
    ismaelhamed commented #4419
  • Jul 10 01:20
    Aaronontheweb commented #4419
  • Jul 10 01:03
    to11mtm commented #4419
  • Jul 09 23:40
    Aaronontheweb commented #4508
Daniel Ferreira Monteiro Alves
@danfma
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
Daniel Ferreira Monteiro Alves
@danfma
that's the problem
Natan Vivo
@nvivo
In essense, you should have only Receive<BeginWork>(_ => OnBeginWork())); and get your services in some other way, as dependencies for example
Daniel Ferreira Monteiro Alves
@danfma
yes
but in this case, some services lives only that the scope defined by that call, that's why I used that.
it just wraps the call with a scope
Daniel Ferreira Monteiro Alves
@danfma
@skotzko Thanks for the site! I already saw part of it before, but I will read the rest! :D
Andrew Skotzko
@skotzko
sure thing
Brandon Wilhite
@JediMindtrick
@Danthar That's why I had in parens (pick your transport)...going that way you have a number of options. Rabbit would be a good choice too, imo.
Brandon Wilhite
@JediMindtrick
@Aaronontheweb Thanks for the story :) ...y, I knew as soon as the other guy mentioned endianness there was a problem. Akka.io wrapper seems like a suitable strategy.
Daniel Ferreira Monteiro Alves
@danfma
@skotzko Thanks for that link! I read it to the end here and now I can see what was happening! :)
Andrew Skotzko
@skotzko
@danfma you’re welcome :)