Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 10:41
    Aaronontheweb commented #4097
  • 08:19
    ismaelhamed synchronize #4097
  • 02:22
    kimbyungeun opened #4098
  • Dec 15 19:47

    Aaronontheweb on dev

    TypeExtensions.TypeQualifiedNam… (compare)

  • Dec 15 19:47
    Aaronontheweb closed #4071
  • Dec 15 19:47
    Aaronontheweb closed #3767
  • Dec 15 19:47
    Aaronontheweb labeled #3767
  • Dec 15 19:47
    Aaronontheweb labeled #3767
  • Dec 15 19:47
    Aaronontheweb milestoned #3767
  • Dec 15 19:44
    Aaronontheweb labeled #4097
  • Dec 15 19:44
    Aaronontheweb milestoned #4097
  • Dec 15 13:23
    Aaronontheweb commented #4096
  • Dec 15 13:22
    Aaronontheweb commented #4093
  • Dec 15 13:16
    ismaelhamed commented #4093
  • Dec 15 13:04
    ismaelhamed edited #4097
  • Dec 15 13:04
    ismaelhamed opened #4097
  • Dec 15 12:50
    ismaelhamed commented #4096
  • Dec 15 12:48
    ismaelhamed commented #4096
  • Dec 15 12:05
    Aaronontheweb commented #4096
  • Dec 15 11:43
    ismaelhamed commented #4096
Bartosz Sypytkowski
@Horusiath

@DamianReeves in Akka (and other message based models) it's easier to define a contract on message level, i.e:

interface IMyProtocolMessage {}
sealed class MyMessage1 : IMyProtocolMessage {}
sealed class MyMessage2 : IMyProtocolMessage {}

Unlike method calls, messages are composable. You can wrap one message with another, batch them, redirect or persist if necessary. Also, you can define dynamic interfaces (through Become) with that.

For type safety it's possible to wrap IActorRefs with typed version (think IActorRef<IMyProtocolMessage>) - I've made this a default in Akkling.

Damian Reeves
@DamianReeves
Hmm... that makes sense. So @Horusiath when you store IActorRefs in your actor implementations you store IActorRef<T>s so that that lets you know what set of messages you can send?
Bartosz Sypytkowski
@Horusiath
yes, I use custom surrogate wrapper over existing one
which contains type parameter
Damian Reeves
@DamianReeves
Cool, will crack open Akkling and take a look. I was starting to feel like the whole Akka.Interfaced approach was solving one problem but eliminating some of the benefits of a message oriented app model
Bartosz Sypytkowski
@Horusiath
Akkling is in F# - in C# you can do a little more (F# doesn't allow you do explicitly define covariant/contravariant types)
Damian Reeves
@DamianReeves
So what is the role of the TypedActorRefSurrogate<'Message>, is that for serialization purposes?
Bartosz Sypytkowski
@Horusiath
yes, actor refs need to have their own custom serialization/deserialization strategy - they are not serializable/deserializable without context. This is where surrogates come to play.
Damian Reeves
@DamianReeves
Ok, will have to look at examples of Akka's serialization surrogate usage. I like the pattern
Vagif Abilov
@object
When using F# API and piping an async task, where should a client catch possible task cancellation exception?
I.e. if the code looks like
doSomethingAsync |!> mailbox.Self
And doSomethingAsync is cancelled
How does this cancellation propagated to an F# actor function?
Bartosz Sypytkowski
@Horusiath
@object not tested but I guess it should be Failure message with TimeoutException inside
Ronnie Overby
@ronnieoverby
Messages are not copied when being passed between local actors, correct?
Vagif Abilov
@object
@Horusiath Failure message? What kind of message is it? Where is it defined?
Marc Piechura
@marcpiechura
@ronnieoverby correct, that's also the reason why your messages need to be immutable
Ronnie Overby
@ronnieoverby
Which is why I'm asking :)
Marc Piechura
@marcpiechura
;)
Ronnie Overby
@ronnieoverby
I'm adapting some legacy code to akka and was thinking about reusing some existing poco types that aren't immutable.
But doesn't look like that's a good idea.
Marc Piechura
@marcpiechura
Yeah would probably lead to some race conditions especially if you have lists and so on in your messages
You could maybe use a base actor that does deep coping like orleans does but that would slow down all the things
Ronnie Overby
@ronnieoverby
I don't have a big problem with writing mapping code to an immutable type
Marc Piechura
@marcpiechura
@object If the F# operator is using the normal PipeTo extension method then it's Status.Failure, see https://github.com/akkadotnet/akka.net/blob/dev/src/core/Akka/Actor/PipeToSupport.cs#L32
Vagif Abilov
@object
@Silv3rcircl3 yes it's using the normal PipeTo. Thanks for the link. Now it's clear.
Damian Reeves
@DamianReeves
Since messages are supposed to be immutable why is it that we don't see more examples of using structs as message types. @Horusiath I looked at your AkkaCqrs example again and you are using structs, was that just an experiment, or is that how you commonly proceed?
Damian Reeves
@DamianReeves
Can my ActorSystem be run in Azure in a Web job?
qwoz
@qwoz
You can run arbitrary .exe files in a web job, so theoretically I don't see why not. As to whether you ought to... :)
Bartosz Sypytkowski
@Horusiath
@DamianReeves my CQRS example is slightly outdated. Regarding structs this won't help a lot (I think), because messages bo through untyped mailbox so structs will be boxed anyway.
regarding web jobs - it's possible, I know that problem may be with exposing enpoint in cluster scenarios
Shuffzord
@Shuffzord
Hey guys, is there any room for some technical help in c# akka.net ?
Bart de Boer
@boekabart
stackoverflow, of course, and this room.
Shuffzord
@Shuffzord
I'm trying to setup nlog to be default logger for akka.net. I've included entries in config. loggers = ["Akka.Logger.NLog.NLogLogger, Akka.Logger.NLog"] with proper (i think) nlog entries but i still get buslogger as the default logger. How can i debug what config is used for system creation and what logger is picked?
Shuffzord
@Shuffzord
To add more depth to the qeustion. I tried to create cluste rsystem with and without explicit config var section = (AkkaConfigurationSection)ConfigurationManager.GetSection("akka"); var system = ActorSystem.Create("webcrawler2"); ClusterSystem = ActorSystem.Create("webcrawler", section.AkkaConfig);
In both cases, cluster system in its 'settings' has loggers with 1 entry of nlog but the Logger of cluster system is set us buslogger
Bartosz Sypytkowski
@Horusiath
@Shuffzord what exact path for loggers config did you use?
Shuffzord
@Shuffzord

@Horusiath this is from my config file. Akka: <akka> <hocon> <![CDATA[ akka { loglevel = DEBUG loggers = ["Akka.Logger.NLog.NLogLogger, Akka.Logger.NLog"] log-config-on-start = on } ]]> </hocon> </akka>

And configsections deifinition

    <section name="akka" type="Akka.Configuration.Hocon.AkkaConfigurationSection, Akka" />
    <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>

And nlog section

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" throwExceptions="true" internalLogFile="C:\Temp\internal_log_file.txt" debug="true" internalLogLevel="Trace"> <targets> <target name="f1" xsi:type="File" fileName="Scrapper.logfile" layout="[${date}] [${threadid}] [${message}]" /> <target name="c" xsi:type="Console" layout="[${threadid}] [${message}]" /> </targets> <rules> <logger name="*" writeTo="f1" /> <logger name="*" writeTo="c" minlevel="DEBUG" /> </rules> </nlog>

tried to create actiorsystem in following ways
var section = (AkkaConfigurationSection)ConfigurationManager.GetSection("akka"); var system = ActorSystem.Create("webcrawler2"); ClusterSystem = ActorSystem.Create("webcrawler", section.AkkaConfig);
As i see, first version is basically what is done is original source code

Ohh and getting logger is private readonly ILoggingAdapter _logger = Context.GetLogger();
Bartosz Sypytkowski
@Horusiath
you don't need to access ConfigurationManager explicitly - app.config content will be loaded automatically
Shuffzord
@Shuffzord
thats what i read but since it wasnt working i tried to do it manually
no difference though
Bartosz Sypytkowski
@Horusiath
I've create a fresh project with Akka.Logger.NLog and had no problems with plugin itself (more with nlog config section within app.config) - but at least this proves, that NLog is used indeed
Shuffzord
@Shuffzord
i dont think it sthe akka problem anymore i think its something in nlog
i will try to check internal logs
thanks for help though
wdspider
@wdspider
@Shuffzord after running into a similar issue a couple months back, I concluded that nlog likes to fail silently when it can't parse its config file. I ended up hard-coding the following InternalLogger settings, so that it wouldn't be quite so silent:
public class Program
{
    public static void Main(string[] args)
    {
        // Ensure NLog logs errors even if config file can't be parsed
        InternalLogger.LogLevel = LogLevel.Error;
        InternalLogger.LogToConsoleError = true;
        InternalLogger.LogToTrace = true;
        InternalLogger.LogFile = "nlog.errors";

        // Initialize topshelf service
        HostFactory.Run(x =>
        {
            x.SetServiceName("MyService");
            x.SetDisplayName("My Service");

            x.UseNLog();

            x.StartAutomaticallyDelayed();
            x.Service<MyService>();
        });
    }
}
Kevin Avignon
@Kavignon
Hi. I have a quick question. On the akka-bootcamp repo, it mentions that the support for F# is accepted. What's currently lacking with the F# implementation compared to the C# one ? I'd like to be able to implement an event-based architecture with Akka.NET to create an rpg prototype. Am I getting over my head here doing it with F# ?
Bartosz Sypytkowski
@Horusiath
@Kavignon default F# API doesn't allow you to describe some things that are necessary for features like cluster sharding or cluster singleton (Akkling API does however) - in general F# API is less used and less tested and you'll have less examples for it - usual thing in smaller communities.
Damian Reeves
@DamianReeves
I'm looking to begin work on an Akka.Persistence plugin for Marten. The required serialization format is JSON, is there a way for me to have messaging use Wire and Persistence use JSON?