These are chat archives for akkadotnet/akka.net

30th
Apr 2018
Bartosz Sypytkowski
@Horusiath
Apr 30 2018 06:07
@keithn I know, that people are using cluster sharding on production - in akka beta usually means, that the final version of an API may change a little (for cluster sharding it remain the same for last 0.5-1 year) and that a separate benchmark tests still needs to be done.
Conceptually you don't need to learn a lot more to understand sharding, than akka actors mechanics - I think I've put full on that topic (both high level and technical details) in 2 articles on petabridge site. Also actors are totally different programming paradigm than using a cache to store state - it's about building stateful applications. For cluster sharding a persistent db is used only by coordinator to keep consistent track of what shards have been created and where they belong.
jameswilddev
@jameswilddev
Apr 30 2018 10:17
Hello! Does Akka.NET's implementation of HOCON include the full range of byte size units (https://github.com/lightbend/config/blob/master/HOCON.md#size-in-bytes-format )? The nearest code I can find only seems to support "b" (bytes): https://github.com/akkadotnet/akka.net/blob/3f924fda8d6ca55c5af90a710d23be8ce36d5c7a/src/core/Akka/Configuration/Hocon/HoconValue.cs#L443
Simon Burgoyne
@simboo
Apr 30 2018 13:36

When using
Sink.OnComplete<TIn>(Action success, Action<Exception> failure)

In the success/failure actions Context.Self changes from the actor address to that of the flow, is this expected, known about ?

Self: Debug Trace: 1. Before streaming 2. In success action.

  1. akka://test/user/actorthatstreams
  2. akka://test/user/actorthatstreams/StreamSupervisor-0/Flow-0-0-unknown-operation

I've written a failing test:

using System;
using System.Linq;

using Akka.Actor;
using Akka.Streams;
using Akka.Streams.Dsl;
using Akka.TestKit.VsTest;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Playground
{
    [TestClass]
    public class SelfTests : TestKit
    {
        public SelfTests()
            : base(
                @"akka.loglevel = DEBUG 
                  akka.suppress-json-serializer-warning = on
                  akka.actor.debug.lifecycle = on")
        {
        }

        [TestMethod]
        public void SelfDoesNotChangeWhenWeStream()
        {
            var aut = Sys.ActorOf<ActorThatStreams>("actorthatstreams");
            var self1 = aut.Ask<string>(new GetSelf(), TimeSpan.FromSeconds(1)).Result;

            System.Diagnostics.Debug.WriteLine($"1. {self1}");

            Watch(aut);
            var self2 = aut.Ask(new RunStream(), TimeSpan.FromSeconds(1)).Result;

            System.Diagnostics.Debug.WriteLine($"2. {self2}");

            Assert.AreEqual(self1, self2);
        }
    }

    public class GetSelf { }
    public class RunStream { }
    public class StopSelf { }

    public class ActorThatStreams : ReceiveActor
    {
        private IActorRef sender;

        public ActorThatStreams()
        {
            Receive<GetSelf>(message => { Sender.Tell(GetSelf()); });
            Receive<StopSelf>(message => { Context.Stop(Self); });
            Receive<RunStream>(message =>
            {
                sender = Sender;
                Source.From(Enumerable.Range(1, 10)).RunWith(Sink.OnComplete<int>(OnSuccess, OnFailure), Context.Materializer());
            });            
        }

        private void OnSuccess() { Stop(); }
        private void OnFailure(Exception obj) { Stop(); }

        private void Stop()
        {
            sender.Tell(GetSelf());
            Context.Stop(Self);
        }

        private string GetSelf()
        {            
            return Self.Path.ToString();  
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Akka" version="1.3.6" targetFramework="net461" />
  <package id="Akka.Streams" version="1.2.3" targetFramework="net461" />
  <package id="Akka.TestKit" version="1.2.3" targetFramework="net461" />
  <package id="Akka.TestKit.VsTest" version="1.2.0.4-beta" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
  <package id="Reactive.Streams" version="1.0.2" targetFramework="net461" />
  <package id="System.Collections.Immutable" version="1.3.1" targetFramework="net461" />
</packages>
Aaron Stannard
@Aaronontheweb
Apr 30 2018 14:12
@jameswilddev I think we just support "bytes"
no kb or mb
Yesh Nadella
@yesh-nadella
Apr 30 2018 14:23

I'm using DistributedPubSub extension and I'm getting the below error. Am I missing a setting? I'm not sure why "akka.tcp://" is missing from the second path.

Message Status from akka.tcp://Test@localhost:4057/system/distributedPubSubMediator to akka://Test/system/distributedPubSubMediator was not delivered. 5 dead letters encountered

Marc Piechura
@marcpiechura
Apr 30 2018 16:22
@simboo the success and failure callbacks are called in the Flow actor, not in your ActorThatStreams, so you need to create a closure of Self and pass this to onsuccess and onfailure
AndreSteenbergen
@AndreSteenbergen
Apr 30 2018 16:26
Is there any way to get some information from exceptions? I am running on a test server, and I run into an null pointer exception somwhere.
[ERROR][4/30/18 4:23:17 PM][Thread 0005][akka://crawler/user/api/https%3A%2F%rottentomatoes.com%2F/coordinators] Object reference not set to an instance of an object.
Cause: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Akka.Actor.ActorCell.HandleFailed(Failed f)
at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)
It is the TrackingService from the crawler example on github which is giving this issue, but I have no real clue what object is null which I am trying to use
Simon Burgoyne
@simboo
Apr 30 2018 19:28
@marcpiechura Thx makes sense.
AndreSteenbergen
@AndreSteenbergen
Apr 30 2018 20:07
Fixed the issue, a check I forgot to make 1 null check, but the issue still exists. How to get a better stack trace, in regular c# coding you would end up with a stacktrace leading to a line number .... The exception raised in the actor seems lost to me.