Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 05 17:21
    Aaronontheweb synchronize #4079
  • Dec 05 17:20
    Aaronontheweb labeled #4084
  • Dec 05 17:20
    Aaronontheweb labeled #4084
  • Dec 05 17:20
    Aaronontheweb milestoned #4084
  • Dec 05 17:20

    Aaronontheweb on dev

    Remove string interpolation fro… (compare)

  • Dec 05 17:20
    Aaronontheweb closed #4084
  • Dec 05 17:20
    Aaronontheweb commented #4084
  • Dec 05 15:43
    ismaelhamed opened #4084
  • Dec 04 23:34

    Aaronontheweb on dev

    Made cleanup call thread-safe (… (compare)

  • Dec 04 23:34
    Aaronontheweb closed #4081
  • Dec 04 23:34
    Aaronontheweb closed #4020
  • Dec 04 19:08
    Aaronontheweb commented #4079
  • Dec 04 18:35
    maratoss review_requested #4079
  • Dec 04 18:26
    maratoss synchronize #4079
  • Dec 04 07:42
    jiyeongj edited #4083
  • Dec 04 06:45
    jiyeongj opened #4083
  • Dec 04 06:35
    dependabot-preview[bot] labeled #130
  • Dec 04 06:35
    dependabot-preview[bot] opened #130
  • Dec 04 06:35

    dependabot-preview[bot] on nuget

    Bump System.Data.SqlClient from… (compare)

  • Dec 03 19:10
    Aaronontheweb synchronize #4081
Aaron Stannard
@Aaronontheweb
@smitcham FYI
In order to do a release, we need to do the following:
  • Update RELEASE_NOTES.md with a new version bump. Follow the convention there.
  • Submit a PR to the master branch once all of the changes have been brought in.
would you consider sending in another PR to do that?
Steven Mitcham
@smitcham
sure.
Aaron Stannard
@Aaronontheweb
and maybe upgrade to Akka.NET 1.1?
thanks, that'd be a big help
Steven Mitcham
@smitcham
also sure. I put that in a while back.
Aaron Stannard
@Aaronontheweb
I meant upgrade the package :p
so we can release it with updated dependencies
Steven Mitcham
@smitcham
yep
Aaron Stannard
@Aaronontheweb
@corneliutusnea heh, I'll give that a shot
going to be starting on that project soon-ish
Aaron Stannard
@Aaronontheweb
@smitcham doh, found a bug in the Akka.DI.TestKit because of that: akkadotnet/Akka.DI.Unity#4
already have a fix up for it: akkadotnet/akka.net#2189
fouimette
@fouimette
Is there a list of Hocon configuration options? I am looking for that dead letter logging option. Even better, where in the source can i find this option?
Steven Mitcham
@smitcham
@Aaronontheweb Here's the updated pull request. Let me know if it needs anything else akkadotnet/Akka.DI.Unity#5
Aaron Stannard
@Aaronontheweb
@fouimette the Config namespaces for each module have reference files built into them
check out the source
Arsene
@Tochemey
Hello how do I use EventFilter to test dead letters?
Arsene
@Tochemey
Hello How can I test the Event Bus pub/sub feature?
Bartosz Sypytkowski
@Horusiath
@Tochemey you can subscribe test actor or probe to event bus and verify it after publishing an event
Arsene
@Tochemey

@Horusiath I am doing some test of an Actor that supposes to write into file upon receiving every event. The actor subscribes to the type of event to receive. However when I published N number of events to the event bus the actor only act on the first event by writing it into the file. The others are kind of ignored. This is the test code

            ActorSystemRefs.ActorSystem = Sys;
            var actorSystem = ActorSystemRefs.ActorSystem;

            var loggingActor =
                actorSystem.ActorOf(Props.Create(() => new FileLoggerActor()));
            actorSystem.EventStream.Subscribe(loggingActor, typeof (AuditLog));
            actorSystem.EventStream.Subscribe(TestActor, typeof(Acknowleged));

            Within(TimeSpan.FromSeconds(timeout),
                () =>
                {
                    actorSystem.EventStream.Publish(new AuditLog(GuidFactory.Create().ToString(), DateTime.UtcNow, "me", "0000", "debit1", "mobile"));
                    actorSystem.EventStream.Publish(new AuditLog(GuidFactory.Create().ToString(), DateTime.UtcNow, "me", "0000", "debit2", "mobile"));
                    actorSystem.EventStream.Publish(new AuditLog(GuidFactory.Create().ToString(), DateTime.UtcNow, "me", "0000", "debit3", "mobile"));
                    var result = ExpectMsgAllOf<Acknowleged>();

                    Assert.NotNull(result);
                });

and this is the Actor:

    public class FileLoggerActor : ReceiveActor
    {
        private static string _filePath;


        public FileLoggerActor()
        {
            Ready();
        }

        public override void AroundPreStart()
        {
            ReadConfiguration();
        }

        public sealed override void Ready()
        {
            Receive<AuditLog>(log =>
            {
                WriteToFile(log);
                // This code is for testing purpose
                ActorSystemRefs.PushEvent(new Acknowleged(log));
            });
        }

        private static void ReadConfiguration()
        {
            _filePath = ConfigurationManager.AppSettings["FileLogger.FilePath"];
            if (_filePath == null)
            {
                throw new ConfigurationErrorsException(
                    "Configuration appSetting FileLogger.FilePath not" +
                    "found for FileLogger actor.");
            }

            // If audit trail file path is a relative file path, 
            // convert it to an absolute path.
            _filePath = _filePath.Replace("~", AppDomain.CurrentDomain.BaseDirectory);
        }

        private static void WriteToFile(AuditLog log)
        {
            var jsonString = JsonConvert.SerializeObject(log, Formatting.None);
            File.AppendAllText(_filePath, jsonString + Environment.NewLine);
        }
    }
Arjen Smits
@Danthar
@Tochemey what if you pass the TestProbe as an dependency in your FileLoggerActor constructor, and use that reference? Instead of your 'ActorSystemRefs.PushEvent'
voltcode
@voltcode
Fxfsl
voltcode
@voltcode
Oops mobile, soz
Bartosz Sypytkowski
@Horusiath
@Tochemey what about this?:
actorSystem.EventStream.Publish(new AuditLog(GuidFactory.Create().ToString(), DateTime.UtcNow, "me", "0000", "debit1", "mobile"));
ExpectMsg<Acknowleged>(x=> x.Property == "debit1");
actorSystem.EventStream.Publish(new AuditLog(GuidFactory.Create().ToString(), DateTime.UtcNow, "me", "0000", "debit2", "mobile"));
ExpectMsg<Acknowleged>(x=> x.Property == "debit2");
actorSystem.EventStream.Publish(new AuditLog(GuidFactory.Create().ToString(), DateTime.UtcNow, "me", "0000", "debit3", "mobile"));
ExpectMsg<Acknowleged>(x=> x.Property == "debit3");
or even:
actorSystem.EventStream.Publish(new AuditLog(GuidFactory.Create().ToString(), DateTime.UtcNow, "me", "0000", "debit1", "mobile"));
actorSystem.EventStream.Publish(new AuditLog(GuidFactory.Create().ToString(), DateTime.UtcNow, "me", "0000", "debit2", "mobile"));
actorSystem.EventStream.Publish(new AuditLog(GuidFactory.Create().ToString(), DateTime.UtcNow, "me", "0000", "debit3", "mobile"));
ExpectMsg<Acknowleged>(x=> x.Property == "debit1");
ExpectMsg<Acknowleged>(x=> x.Property == "debit2");
ExpectMsg<Acknowleged>(x=> x.Property == "debit3");
Garrard Kitchen
@garrardkitchen
Hi @Aaronontheweb, I took a punt at upgrading projects to 1.1.1 but experiencing same error with mono. Works fine on windows but not on the mac and here comes a bigger BUT….but, I’ve just realised I'm not actually comparing apples with apples here and I’m sure this will be relevant!…In win env I’m using .net but it’s only the mac I’m using mono.
Maxim Cherednik
@maxcherednik
Hi @Aaronontheweb, while Akka.Cluster was in beta the process of graceful node shutdown was a bit verbose and there were some error messages with socket exceptions and so on. That time you were saying that you guys will handle this and remove unnecessary exception logging. So at the moment I am trying the same thing - graceful node shutdown and I see some exceptions with error level ERROR - is this ok or it wasn't fixed? Even though cluster works fine. It's just those messages which makes me worried.
Samurai Ken
@themdrnsamurai

Hey all. I am exploring this "actors" thing, and had a question... in lookgin at Orleans and Akka, I want to make sure I am not fundementally makign a conceptual error. I am working on expanding the scalability and maintainability of a social application. There is already a DocumentDB record for each user with a class / object overlay that provides some linited interfaces to interact with it, a manager to instantiate it and so on.

Obviously, we have re-implemented (badly) somethign that others have done better :)

So does it make sense to put an Actor as a sort of smart cache / internaction model but still have the authoritative data for a user live in the documentDB rather than exist soley in the Actors persistent state? Or is that sort of half comitting to this.

Arsene
@Tochemey
@Horusiath Thank you. The proposed solution works as expected.
Bartosz Sypytkowski
@Horusiath
@themdrnsamurai it depends on how are you going to access the data inside DocumentDB - if you want to use actors as a form of smart cache, then they should either have a full authority over writing any new data to docdb or have a some sort of scheduled task that will trigger the state refresh within some time intervals.
Samurai Ken
@themdrnsamurai

@Horusiath - thanks, yeah, it sems pretty clear ideally the actor should be the sole interface to the underlying DB record. And that is with me. I just wont be able to seel converting our date purely to live within the actor state persistence store but I can se;; this.

The idea is that if, in the future, we need to interface with the data in some other way or move to another technology the data is not deeply tied to the actor implementation chosen.

Bartosz Sypytkowski
@Horusiath
you could create your own "record" object, and just bind its methods to akka actor receiviers
so actor will work as a shell around your "record" - it's pretty limiting the possibilities of particular actor model, but it's the most framework agnostic approach
Arsene
@Tochemey
Hello how do I define an Actor state that will be available during the lifetime of the actor.
Samurai Ken
@themdrnsamurai
@Horusiath I hear you on that being limiting, I am sort of hoping to avoid that (having the DocumentDB record actually act as the store for the Actor directly) it just seems liek that shoudl be wrong somehow :)
Bart de Boer
@boekabart
@Tochemey please elaborate
Bartosz Sypytkowski
@Horusiath
@Tochemey actor's fields and properties is what we call actor state
Arsene
@Tochemey

This is the code:

public class ModulesActor : ReceiveActor
    {
        private Dictionary<string, Tuple<Props, ModuleState>> _moduleRecipes;

        public ModulesActor()
        {
            Ready();
        }

        public override void AroundPreStart()
        {
            _moduleRecipes = new Dictionary<string, Tuple<Props, ModuleState>>();
        }

        public override void AroundPostStop()
        {
            _moduleRecipes = null;
        }

        protected void Ready()
        {
            Receive<LoadModules>(modules => Load());
            Receive<ModulesLoaded>(c =>
            {
                _moduleRecipes = c.Modules;
            });

            Receive<GetModuleMeta>(whois =>
            {
                Sender.Tell(GetModuleMeta(whois.ModuleName));
            });

            Receive<CheckModuleState>(state =>
            {
                Sender.Tell(GetModuleState(state.ModuleName));
            });
        }

        private ModuleState GetModuleState(string moduleName)
        {
            if (!_moduleRecipes.ContainsKey(moduleName))
                return ModuleState.NOT_IMPLEMENTED;
            return _moduleRecipes[moduleName].Item2;
        }

        protected override SupervisorStrategy SupervisorStrategy()
        {
            return new OneForOneStrategy(1,
                // maxNumberOfRetries
                TimeSpan.FromSeconds(30),
                // withinTimeRange

                exception => // localOnlyDecider
                {
                    //Error that we cannot recover from, stop the failing actor
                    if (exception is NotSupportedException) return Directive.Stop;

                    // Error related to configuration setting
                    if (exception is ConfigurationErrorsException) {
                        return Directive.Escalate;
                    }

                    //In all other cases, just stop the failing actor
                    return Directive.Stop;
                });
        }

        private ModuleMeta GetModuleMeta(string moduleName)
        {
            if (!_moduleRecipes.ContainsKey(moduleName)) return null;
            var moduleMeta = new ModuleMeta(_moduleRecipes[moduleName].Item1,
                _moduleRecipes[moduleName].Item2);
            return moduleMeta;
        }

        private static void Load()
        {
            var loader = Context.ActorOf(Props.Create(() => new ModulesLoadingActor()));
            loader.Forward(new LoadModules());
        }
    }

This is the test I am running:

        public void ModulesLoaderActorShouldReturnALoadedModule()
        {
            ActorSystemRefs.ActorSystem = Sys;
            var actorSystem = ActorSystemRefs.ActorSystem;
            var moduleManager = actorSystem.ActorOf(Props.Create(() => new ModulesActor()));
            moduleManager.Tell(new LoadModules());
            var result = ExpectMsg<ModulesLoaded>();
            Assert.NotNull(result);

            moduleManager.Tell(new CheckModuleState("mtn-gh"));
            var moduleMeta = ExpectMsg<ModuleMeta>();
            Assert.NotNull(moduleMeta);
            Assert.True(moduleMeta.State == ModuleState.ONLINE);
        }

The issue I am facing is that the moduleMeta.State does not return the expected value. The first assertion works smoothly.

Bart de Boer
@boekabart
Your manager never gets ModulesLoaded, is I think your root casue
because you forward the LoadModules, the response goes directly to the external requester. in this case, TestActor
Arsene
@Tochemey
@boekabart Any solution?
Bart de Boer
@boekabart
Tell instead of forward.
(note that your 'outer' actor won't get confirmation directly anymore)
Arsene
@Tochemey
@boekabart The reason I used forward is that I do not want to pass the SenderRef into the message.
@boekabart and the Ask-PipeTo is not too recommended in Actors.
Bart de Boer
@boekabart
yes, but you do want to the loader to respond to the manager, right?
Arsene
@Tochemey
@boekabart Yes
Bart de Boer
@boekabart
separate your 'outer contract' from your 'inner contract'