These are chat archives for akkadotnet/akka.net

1st
Feb 2018
Bruce Boutelje
@bboutelje
Feb 01 2018 00:18
After I've failed to deliver my message through an AtLeastOnceDeliveryActor, how would I trigger these undelivered messages to be delivered again? Do I have to restart the actor?
Aaron Stannard
@Aaronontheweb
Feb 01 2018 00:59
@hhko it is possible to reload HOCON
we have to do it for when we're working with serializers in Akka.NET
going to grab an example rq
Aaron Stannard
@Aaronontheweb
Feb 01 2018 01:14
Settings.InjectTopLevelFallback will rebuild the config automatically
we use it when chaining plugins together
and Akka.Persistence implementations use that under the hood too
Onur Gumus
@OnurGumus
Feb 01 2018 06:35
How are child actors created from outside? This example sends a message : http://getakka.net/articles/actors/fault-tolerance.html
Alex Michel
@amichel
Feb 01 2018 10:46
Hi, what is the license type of PBM?
chipdice
@chipdice
Feb 01 2018 14:58
@Aaronontheweb - I solved my issue by creating a new project in my solution called Akka.Cluster.Tests. I copied the TestMember code into this project. This works because the Akka.Cluster assembly makes it's internals visible to the assembly Akka.Cluster.Tests. In my Akka.Cluster.Tests assemby, I made it's internals visible to my Test project. With this setup I was able to create a Member using the TestMember static. Do you think it feasible to include TestMember in TestKit so that testing these scenarios is more straightforward?
not an OSS license, but it is free to use
Aaron Stannard
@Aaronontheweb
Feb 01 2018 16:29
@chipdice wait a minute, is Member itself internal? I didn't think it was
otherwise, I would just copy the source code into my own test project
and edit it was needed
if you preserve the licensing headers and link back to the Akka.NET "License.MD" file you should be fine
if you have legal folks worried about doing that
Apache 2 is permissive by design
troasfl
@troasfl
Feb 01 2018 16:33
hi, can some one please assist me to resolve this error:
2018-02-01 16:30:24.504 +00:00 [Error] [akka://267b60b719b64e30bfdfc58d99c75b71/deadLetters] Error caught channel "[::ffff:127.0.0.1]:61552"->"[::ffff:127.0.0.1]:19001"
DotNetty.Codecs.DecoderException: Exception of type 'DotNetty.Codecs.DecoderException' was thrown. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at DotNetty.Common.Internal.PlatformDependent.CopyMemory(Byte[] src, Int32 srcIndex, Byte[] dst, Int32 dstIndex, Int32 length)
at DotNetty.Buffers.HeapArena.MemoryCopy(Byte[] src, Int32 srcOffset, Byte[] dst, Int32 dstOffset, Int32 length)
at DotNetty.Buffers.PoolArena1.Reallocate(PooledByteBuffer1 buf, Int32 newCapacity, Boolean freeOldMemory)
at DotNetty.Buffers.PooledByteBuffer`1.AdjustCapacity(Int32 newCapacity)
at DotNetty.Buffers.AbstractByteBuffer.EnsureWritable0(Int32 minWritableBytes)
at DotNetty.Buffers.AbstractByteBuffer.EnsureWritable(Int32 minWritableBytes)
at DotNetty.Buffers.AbstractByteBuffer.WriteBytes(IByteBuffer src, Int32 srcIndex, Int32 length)
at DotNetty.Buffers.AbstractByteBuffer.WriteBytes(IByteBuffer src, Int32 length)
at DotNetty.Buffers.AbstractByteBuffer.WriteBytes(IByteBuffer src)
at DotNetty.Codecs.ByteToMessageDecoder.<>c.<.cctor>b__27_0(IByteBufferAllocator allocator, IByteBuffer cumulation, IByteBuffer input)
at DotNetty.Codecs.ByteToMessageDecoder.ChannelRead(IChannelHandlerContext context, Object message)
--- End of inner exception stack trace ---
at DotNetty.Codecs.ByteToMessageDecoder.ChannelRead(IChannelHandlerContext context, Object message)
at DotNetty.Transport.Channels.AbstractChannelHandlerContext.InvokeChannelRead(Object msg)
Aaron Stannard
@Aaronontheweb
Feb 01 2018 16:34
looks like DotNetty couldn't load one of its dependencies
it's the library that Akka.Remote uses internally
what runtime are you using?
troasfl
@troasfl
Feb 01 2018 16:34
.net framework 4.6.2
Aaron Stannard
@Aaronontheweb
Feb 01 2018 16:39
yeah, not sure why you're having that issue
I'd try doing a update-package Akka.Remote -reinstall
and make sure all of the dependencies come down
troasfl
@troasfl
Feb 01 2018 16:39
ok
Onur Gumus
@OnurGumus
Feb 01 2018 18:11
Is this doc wrong in terms of child creation ? http://getakka.net/articles/actors/fault-tolerance.html
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:12
which part?
Onur Gumus
@OnurGumus
Feb 01 2018 18:12
It creates the child as supervisor.Tell(Props.Create<Child>());
In test application section
I mean that even doesn't create the child.
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:13
ah yeah
yup
that's wrong
should create the child and then send the IActorRef of the child back to the Sender
mind sending a PR for that?
Onur Gumus
@OnurGumus
Feb 01 2018 18:13
Sort of.
When I have free time I will do.
Though actually I am not sure about the flow.
Child should be created by context
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:15
var supervisor = system.ActorOf<Supervisor>("supervisor");

supervisor.Tell(Props.Create<Child>());
var child = ExpectMsg<IActorRef>(); // retrieve answer from TestKit’s testActor
need to send the child back
Onur Gumus
@OnurGumus
Feb 01 2018 18:16
yeah I understood.
Also I read the doc twice, I couldn't find out what is the default Decision for an exception throwing actor
By experiement, I saw it is being stopped.
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:17
default behavior is to always Restart the actor
Onur Gumus
@OnurGumus
Feb 01 2018 18:17
That's not true
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:18
actors only get stopped by default if they fault more than 10 times per second
Onur Gumus
@OnurGumus
Feb 01 2018 18:18
My experiment shows that it just stops.
that's the default we use
Onur Gumus
@OnurGumus
Feb 01 2018 18:24
Hmm
Maybe I missed something with my experiment
Even that this is not mentioned properly in the docs.
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:24
I submitted a PR just now to fix some of the issues with the docs akkadotnet/akka.net#3308
the docs as they are currently published do describe the default behavior though: http://getakka.net/articles/actors/fault-tolerance.html#default-supervisor-strategy
there's an accuracy issue there which is that we never Escalate anything by default
we always Restart by default
Onur Gumus
@OnurGumus
Feb 01 2018 18:26
"Escalate is used if the defined strategy doesn't cover the exception that was thrown."
This is the first sentence. So this is wrong ?
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:26
that's what I just said
Onur Gumus
@OnurGumus
Feb 01 2018 18:27
I can only see the restart behavior is documented on http://getakka.net/articles/concepts/supervision.html#system-the-system-guardian
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:27
anything that was assingable to Exception is always restart
which in practice ends up being everything
so I've fixed the language there to correct that
Onur Gumus
@OnurGumus
Feb 01 2018 18:28
Okay thanks for the clarification.
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:29
sorry for the errors in the first place
I think my edits should make that more clear
Onur Gumus
@OnurGumus
Feb 01 2018 18:31
How about this line:
The root guardian is the grand-parent of all so-called "top-level" actors and supervises all the special actors mentioned in Top-Level Scopes for Actor Paths using the SupervisorStrategy.StoppingStrategy, whose purpose is to terminate the child upon any type of Exception.
This is more confusing
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:32
the root guardian sits above the /user and /system actors
Onur Gumus
@OnurGumus
Feb 01 2018 18:32
Yes
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:32
you can't bubble up an error to it unless you explicitly override the /user guardian's supervisor strategy
which you can do via configuration
Onur Gumus
@OnurGumus
Feb 01 2018 18:33
Ah ok
I understand
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:33
but if an error makes it up to the / guardian
Onur Gumus
@OnurGumus
Feb 01 2018 18:33
Yes I got it now.
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:33
cool
Onur Gumus
@OnurGumus
Feb 01 2018 18:36
Do we still have ActorRefs.NoSender ?
Aaron Stannard
@Aaronontheweb
Feb 01 2018 18:36
yep
Onur Gumus
@OnurGumus
Feb 01 2018 18:36
ah ok yes. Somehow I couldn't find first.
chipdice
@chipdice
Feb 01 2018 18:42
@Aaronontheweb static Create method on Member is internal
Aaron Stannard
@Aaronontheweb
Feb 01 2018 19:45
@/all Akka.NET v1.3.4 is now live on NuGet: https://twitter.com/AkkaDotNET/status/959150704580587521
Onur Gumus
@OnurGumus
Feb 01 2018 19:47
yay
Vasily Kirichenko
@vasily-kirichenko
Feb 01 2018 20:04
:+1:
ShalokShalom
@ShalokShalom
Feb 01 2018 20:31
@Aaronontheweb Alpakka sounds so nice, I just want to use it for its name ^-^
@OnurGumus Why not use F# directly? It is basically a superset of C#, so you can do all your C#ing there, plus MUCH much more?
Onur Gumus
@OnurGumus
Feb 01 2018 20:36
@ShalokShalom I am curious why this question all of a sudden ?
ShalokShalom
@ShalokShalom
Feb 01 2018 20:38
You once mentioned above, that you want something like in F#
Onur Gumus
@OnurGumus
Feb 01 2018 20:38
Just for emphasizing my interest in F#, I even have a video course on it: https://www.packtpub.com/web-development/learning-functional-programming-f-integrated-course
Yes.
ShalokShalom
@ShalokShalom
Feb 01 2018 20:38
I am wondering at all, why C# is so much in use here
since F-Sharp is developed for this kind of work
Onur Gumus
@OnurGumus
Feb 01 2018 20:39
Few things, I am using Akka at work.
ShalokShalom
@ShalokShalom
Feb 01 2018 20:39
oh fine thanks
for the link
Onur Gumus
@OnurGumus
Feb 01 2018 20:39
As I am the team lead
ShalokShalom
@ShalokShalom
Feb 01 2018 20:39
Ah, I see
ShalokShalom
@ShalokShalom
Feb 01 2018 20:39
And you cant change the language for your own in your own project?
Onur Gumus
@OnurGumus
Feb 01 2018 20:39
I can decide my team if they should use F#
or not
But unfortunately their skill set is not there
ShalokShalom
@ShalokShalom
Feb 01 2018 20:40
I see
Aha, ok
Onur Gumus
@OnurGumus
Feb 01 2018 20:40
At least not yet.
Also VS Tooling is not as good in F#.
Finally I have read a book about functional programming C# recently
ShalokShalom
@ShalokShalom
Feb 01 2018 20:40
I am a beginner, and to me this sounds very confusing
declarative programming is so much more to our nature
ShalokShalom
@ShalokShalom
Feb 01 2018 20:41
i guess imperative programmer move away from this nature
Onur Gumus
@OnurGumus
Feb 01 2018 20:41
Perhaps best book I've read in last decade
ShalokShalom
@ShalokShalom
Feb 01 2018 20:42
I just decided to buy Scotts "Domain Modeling Made Functional"
Onur Gumus
@OnurGumus
Feb 01 2018 20:42
no no just read above really
ShalokShalom
@ShalokShalom
Feb 01 2018 20:42
The thing is, when I read imperative code, my brain starts yelling at me
Onur Gumus
@OnurGumus
Feb 01 2018 20:42
I know scotts book
It will only take half way
ShalokShalom
@ShalokShalom
Feb 01 2018 20:42
its like Chinese to me
half way to what?
Onur Gumus
@OnurGumus
Feb 01 2018 20:42
Half way to functional programming
it's not complete.
ShalokShalom
@ShalokShalom
Feb 01 2018 20:43
"The book, with its many practical examples, is written for proficient C# programmers with no prior FP experience"
Onur Gumus
@OnurGumus
Feb 01 2018 20:43
I don't think scott is developing any real business apps
That book will make you a better F# programmer
ShalokShalom
@ShalokShalom
Feb 01 2018 20:43
Scott did state that his book goes the full way to functional programming?
Onur Gumus
@OnurGumus
Feb 01 2018 20:44
As I said I don't think he does end to end business apps
ShalokShalom
@ShalokShalom
Feb 01 2018 20:44
I am fine with DDD for now.
I see it as the basement.
Of course, there is more.
C#, same as other imperative programming languages, hurt me.
I would never code in such a language with joy.
Just because its my nature.
:)
Translate this book to F# and I buy it in this second
Onur Gumus
@OnurGumus
Feb 01 2018 20:46
I think this shouldn't be translated.
ShalokShalom
@ShalokShalom
Feb 01 2018 20:46
yeah, cool
then its even lesser interesting to me, to be honest
Onur Gumus
@OnurGumus
Feb 01 2018 20:46
The reason is you can do the translation with F#
easily
check the sample code
and you decide
After reading this book, seeing how author tackles the limitations of C# my appreciation of F# greatly increased.
ShalokShalom
@ShalokShalom
Feb 01 2018 20:47
why?
you see it from the perspective of a professional
that is a complete different point of view
quite the opposite
Onur Gumus
@OnurGumus
Feb 01 2018 20:48
Anyway it's your decision after all. I just stated my opinions.
ShalokShalom
@ShalokShalom
Feb 01 2018 20:48
also that you use object orientation in your course such early, lets me stun
and yes, this C-Sharp code looks sane compared to other examples I saw
Onur Gumus
@OnurGumus
Feb 01 2018 20:49
I use object orientation in my course ?
ShalokShalom
@ShalokShalom
Feb 01 2018 20:49
while still not so clean and nice concise as in F#
the link you showed me
Onur Gumus
@OnurGumus
Feb 01 2018 20:50
Well that's part of F# too
And a necessary part
ShalokShalom
@ShalokShalom
Feb 01 2018 20:50
yeah sure
I just think its sane to leave this out so long as possible
to bet so long as possible on the benefits of functional techniques
Onur Gumus
@OnurGumus
Feb 01 2018 20:52
I am personally not that purist. But it depends I guess.
ShalokShalom
@ShalokShalom
Feb 01 2018 20:52
since this seems to be helpful to avoid a load of potential failures?
ShalokShalom
@ShalokShalom
Feb 01 2018 20:53
of course is imperative/OO code also imporant :)
thanks
Onur Gumus
@OnurGumus
Feb 01 2018 20:53
At the bottom you see : that's state monad he uses
var transitions =
           from e1 in Account.Create(create)

           from e2 in Account.Deposit(depositCash)

           from e3 in Account.SetOverdraft(setOverdraft)

           select List<Event>(e1, e2, e3);
combined with event sourcing
ShalokShalom
@ShalokShalom
Feb 01 2018 20:53
yeah, it looks more sane, as said
as casual C# code
I saw yet
Aaron Stannard
@Aaronontheweb
Feb 01 2018 20:54
@ShalokShalom yep, working on publishing the latest Alpakka bits now...
ShalokShalom
@ShalokShalom
Feb 01 2018 20:54
why use C#, if I can use F#?
does it mean the Alpaca language?
Aaron Stannard
@Aaronontheweb
Feb 01 2018 20:54
nah
ShalokShalom
@ShalokShalom
Feb 01 2018 20:54
ah I see
Aaron Stannard
@Aaronontheweb
Feb 01 2018 20:54
it's just a set of community-provided Add-ons for Akka.NET streams
i.e. Kafka, Azure Event Bus, etc
Onur Gumus
@OnurGumus
Feb 01 2018 20:54
I answer that question in my video course. Basically, tooling and better object orientation
Aaron Stannard
@Aaronontheweb
Feb 01 2018 20:54
designed to make it easier to integrate the stream workflows with non-actor based sources
ShalokShalom
@ShalokShalom
Feb 01 2018 20:55
@OnurGumus I am not interested in both, just in order to ditch F#
Onur Gumus
@OnurGumus
Feb 01 2018 20:55
F# doesn't have dynamic as C# equivalent, no protected keyword no covariance, contra variance, no individual line disabling for warnings etc
ShalokShalom
@ShalokShalom
Feb 01 2018 20:56
it sounds like you get a candy and therefore no water for 7 days
Onur Gumus
@OnurGumus
Feb 01 2018 20:56
no live unit test, no dependency diagrams, no UWP apps
ShalokShalom
@ShalokShalom
Feb 01 2018 20:56
you think these things are important for newbies?
Onur Gumus
@OnurGumus
Feb 01 2018 20:56
also debugging experience is a bit challenging
ShalokShalom
@ShalokShalom
Feb 01 2018 20:57
or banks, who saved huge LOC by their transition?
Onur Gumus
@OnurGumus
Feb 01 2018 20:57
no I am not despising F#
I am just stating the possible drawbacks.
ShalokShalom
@ShalokShalom
Feb 01 2018 20:57
I see
thanks a lot
@Aaronontheweb by stating non-actor sources, you mean libraries who are without Akka/Actors?
What do you think is most profitable (for you) from this book?
@OnurGumus ^
What makes it to the best book you have read in this decade?
Onur Gumus
@OnurGumus
Feb 01 2018 21:03
I believe functional programming should be defacto standard for any business app as of now. But until I read that book, I was always thinking these concepts are applicable only for functional prog languages
The book just showed me actually these concepts are rather language independent and with a little noise it can be achievable from C# too.
That enabled me, finally I can do true functional programming on my day time job.
ShalokShalom
@ShalokShalom
Feb 01 2018 21:04
oh yeah
Onur Gumus
@OnurGumus
Feb 01 2018 21:05
It also helped me to understand functional concepts, like applicatives, monads, functors, traversables better
and finally now I appreciate F# more than ever.
Onur Gumus
@OnurGumus
Feb 01 2018 21:05
I am also big fan of CQRS.
ShalokShalom
@ShalokShalom
Feb 01 2018 21:05
I see
Me too ^-^
Onur Gumus
@OnurGumus
Feb 01 2018 21:05
which author also embraces that too
ShalokShalom
@ShalokShalom
Feb 01 2018 21:06
Event sourcing and stuff
What do you think is missing especially in Scotts Book?
Onur Gumus
@OnurGumus
Feb 01 2018 21:06
he even mentions akka.net briefly
I think he developed this over his blog posts
Natan Vivo
@nvivo
Feb 01 2018 21:06
Really happy to see Ask cleaned up!
Onur Gumus
@OnurGumus
Feb 01 2018 21:06
And they are not based on real life project experience
I learned a lot of things from Scott's blog
ShalokShalom
@ShalokShalom
Feb 01 2018 21:07
i see
Onur Gumus
@OnurGumus
Feb 01 2018 21:07
The guy is deep.
But he is a conference guy
Aaron Stannard
@Aaronontheweb
Feb 01 2018 21:07
@nvivo yep, I think that was a good change. Big performance improvement in Ask too. Hats off to @maxcherednik for that
ShalokShalom
@ShalokShalom
Feb 01 2018 21:08
I think you will like Johns interview above.
What exactly do you think is missing in his book?
Especially for a newbie
Onur Gumus
@OnurGumus
Feb 01 2018 21:09
I read that long time ago.
You mean scott's book ?
Firstly I have intended to buy and skimmed to book not actually read it. And I do think it is a good book.
But reading it will not give you the aha moment but only you will end up with more questions.
ShalokShalom
@ShalokShalom
Feb 01 2018 21:14
Like?
Onur Gumus
@OnurGumus
Feb 01 2018 21:20
Example this is BirthDate from Scott's book :
  module Birthdate =
        let create (date:DateTime) : Result<Birthdate,string> = 
            if date.Year < 1900 then
                Error "Birthdate must be after 1900"
            elif date.Year > DateTime.Now.Year then
                Error "Birthdate must not be in the future"
            else
                Ok (Birthdate date) // no error checking
Aaron Stannard
@Aaronontheweb
Feb 01 2018 21:20
@vasily-kirichenko https://www.nuget.org/packages/Akka.Streams.Amqp/ - it's 404-ing right now because the package isn't validated / indexed
but that should be up there momentarily
ShalokShalom
@ShalokShalom
Feb 01 2018 21:22
And?
Onur Gumus
@OnurGumus
Feb 01 2018 21:22
And this is my implementation with C# after reading that book for my own project:
using LaYumba.Functional;
using NodaTime;
using System;
using System.Linq;
using static LaYumba.Functional.F;

namespace SmartCorridor.Shared.Domain
{
    public class BirthDate
    {
        public static Func<CurrentLocalDateTime, LocalDate, Validation<BirthDate>>
             Create => (currentTime, birthDate) => Some(birthDate)
                .Where(_ => birthDate < currentTime.Value.Date)
                .Map(c => new BirthDate(c))
                .Match(
                 None: () => Errors.BirthdateIsTooNew(birthDate),
                 Some: Valid);

        public LocalDate Value { get; }

        BirthDate(LocalDate value)
            => Value = value;

        public override string ToString() => Value.ToString();
    }
}
Which one is more functional and practical ?
ShalokShalom
@ShalokShalom
Feb 01 2018 21:23
I like to ask about the self healing in Erlang and Akka
Well, the above one looks much more concise?
I cant say much about the code quality
since my experience on this field is far to low :)
Onur Gumus
@OnurGumus
Feb 01 2018 21:23
I mean in terms of functional programming
which one is more functional ?
ShalokShalom
@ShalokShalom
Feb 01 2018 21:23
well, both look fine to me from that aspect
you mean if then elif and so on?
Onur Gumus
@OnurGumus
Feb 01 2018 21:24
Look carefully, scott's code is imperative
ShalokShalom
@ShalokShalom
Feb 01 2018 21:24
lol
yeah, I see
your point
to me, this is declarative
this is the important part to me
let me clear this up: more importantly as anything else to me, is that code is declarative
reads declarative
Onur Gumus
@OnurGumus
Feb 01 2018 21:25
yes
ShalokShalom
@ShalokShalom
Feb 01 2018 21:25
lets me think declarative
well, if then can be read so
and I see your point
plus, if then is implemented functional, right?
Onur Gumus
@OnurGumus
Feb 01 2018 21:25
yes
ShalokShalom
@ShalokShalom
Feb 01 2018 21:26
what do you think about the differences between F# and OCaml?
Onur Gumus
@OnurGumus
Feb 01 2018 21:26
I have never used O'Caml. I only know F# syntax is compatible with it.
ShalokShalom
@ShalokShalom
Feb 01 2018 21:26
sort of
its compatible until a certain degree of
Onur Gumus
@OnurGumus
Feb 01 2018 21:27
But I think running on CLR has advantages.
ShalokShalom
@ShalokShalom
Feb 01 2018 21:27
anyway: which is the difference between auto-healing in Akka and OTP?
yeah, sure
on the business side and such
more libraries and so on
on Erlang, do I have to write code to explicitly create such healing supervisors?
in Elixir, Alpaca?
I know I ask this in a Akka channel xD
I am simply curious how much code the developers write in those languages/libraries in order to archive this kind of fault tolerance
is this for free somewhere, build in the language or toolkit?
ShalokShalom
@ShalokShalom
Feb 01 2018 21:34
I like to avoid defensive programming in F#
Onur Gumus
@OnurGumus
Feb 01 2018 21:50
All akka docs are for C#. F# integration is something extra
Onur Gumus
@OnurGumus
Feb 01 2018 22:15
@ShalokShalom var birthdate = Unit().Pipe(CurrentLocalDateTime.Now.Apply(clock)).Pipe(BirthDate.Create.Apply);
That's how I use it :)
F# equivalent would be : let birthdate = () |> (CurrentLocalDateTime.Now clock) |> BirthDate.Create