Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 10:44
    ismaelhamed synchronize #5973
  • 09:47
    ismaelhamed opened #5973
  • May 27 21:23
    Aaronontheweb commented #5604
  • May 27 20:10

    Aaronontheweb on dev

    Trap all exception thrown while… (compare)

  • May 27 20:10
    Aaronontheweb closed #5972
  • May 27 20:10
    Aaronontheweb milestoned #5972
  • May 27 20:10
    Aaronontheweb demilestoned #5972
  • May 27 20:10
    Aaronontheweb milestoned #5972
  • May 27 20:10
    Aaronontheweb labeled #5972
  • May 27 20:09

    Aaronontheweb on v1.4

    Trap all exception thrown while… (compare)

  • May 27 20:09
    Aaronontheweb closed #5971
  • May 27 20:09
    Aaronontheweb auto_merge_disabled #5971
  • May 27 19:47
    zbynek001 commented #5604
  • May 27 19:06
    Aaronontheweb commented #5604
  • May 27 19:03
    zbynek001 commented #5604
  • May 27 17:14

    Arkatufus on 1.4.38-beta2

    (compare)

  • May 27 17:12

    Arkatufus on master

    Bump AkkaVersion from 1.4.37 to… Bump MongoDB.Driver from 2.15.0… Fix Akka.Persistence.MongoDb co… and 4 more (compare)

  • May 27 17:12
    Arkatufus closed #261
  • May 27 17:06
    Arkatufus auto_merge_enabled #261
  • May 27 17:05
    Arkatufus opened #261
Daniel Ferreira Monteiro Alves
@danfma
I created a service with a queue of messages
the actors should pop some messages from time to time
Joshua Benjamin
@annymsMthd
Maybe a pooled router with a resizer?
Daniel Ferreira Monteiro Alves
@danfma
I was thinking in use the router to create that behaviour, while checking from time to time that queue
yes!
that's the point!
I created some actors using the async behaviour
Andrew Skotzko
@skotzko
i guess you could have one actor scheduled to receive messages off the queue and then hand them to a resizable pool router for scalable processing
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