Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 14:20
    Aaronontheweb commented #4092
  • 14:14
    Aaronontheweb labeled #4089
  • 14:14
    Aaronontheweb labeled #4089
  • 14:11
    Aaronontheweb synchronize #4089
  • 14:10
    Aaronontheweb synchronize #4086
  • 14:09

    Aaronontheweb on dev

    Convert to ImmutableHashSet for… (compare)

  • 14:09
    Aaronontheweb closed #4090
  • 12:04
    nagytech synchronize #4092
  • 11:53
    nagytech synchronize #4092
  • 11:49
    nagytech edited #4092
  • 11:40
    nagytech opened #4092
  • 11:32
    nagytech edited #4091
  • 11:32
    nagytech opened #4091
  • 10:13
    nagytech commented #3954
  • 05:29
    nagytech commented #4090
  • 05:29
    nagytech opened #4090
  • Dec 11 23:52
    scptre commented #4082
  • Dec 11 14:26
    nagytech commented #3954
  • Dec 11 11:18
    nagytech edited #4089
  • Dec 11 11:17
    nagytech opened #4089
vicosoft4real
@vicosoft4real
message A :smile: public class Message1
{
public Message1(string name1)
{
Name1 = name1;
}
    public string Name1 { get; }
}
Actor A public class ActorA: AtLeastOnceDeliveryReceiveActor
{
    public override string PersistenceId { get; }
    readonly ILoggingAdapter _logger = Context.GetLogger();

    public ActorA()
    {
        PersistenceId = Uri.UnescapeDataString(Self.Path.Name);
        _logger.Info($"Instantiating {nameof(ActorA)} in the constructor with path {Self.Path}");
        Command<Message1>(msg =>
        {
            _logger.Info($"log message {msg.Name1}");
            IActorRef shardRegion2 = Context.System.BootstrapShard<ActorB>("web-node1");
            // Context.ActorOf(Props.Create<ActorB>());

        });
        //Command<Message2>(msg =>
        //{
        //    _logger.Info($"log message {msg.Name1}");

        //});
    }
}
public class ActorB : ReceivePersistentActor
{
    public override string PersistenceId { get; }
    readonly ILoggingAdapter _logger = Context.GetLogger();

    public ActorB()
    {
        PersistenceId = Uri.UnescapeDataString(Self.Path.Name);

        _logger.Info($"Instantiating {nameof(ActorB)} in the constructor with path {Self.Path.Name}");
        Command<Message2>(msg =>
        {
            _logger.Info($"log message {msg.Name1}");

        });

    }
}
at start up I configure my shardding as :smile: ClusterSharding sharding = ClusterSharding.Get(eduSaaSSystem);
IActorRef shardRegion = sharding.Start(
typeName: typeof(ActorA).Name,
entityProps: Props.Create<ActorA>(), // the Props used to create entities
settings: ClusterShardingSettings.Create(eduSaaSSystem)
.WithCoordinatorSingletonSettings(ClusterSingletonManagerSettings.Create(eduSaaSSystem))
.WithRole("web-node")
,
messageExtractor: new CustomMessageExtractor(100 * 10)
);
if i send message to shard region as shardRegion .Tell(new ShardEnvelope(id, messagea));
vicosoft4real
@vicosoft4real
@Aaronontheweb is it possible to send message to actorB with message2
@Aaronontheweb are u with me?
Aaron Stannard
@Aaronontheweb
I think so.... the message extractor is looking for a property called Recipient on the message
ah I see
you're using an envelope for that
but yeah, that message will be received by your persistent actor
vicosoft4real
@vicosoft4real
ok
Mitchell Tannenbaum
@naturallymitchell
How does Akka.net differ from Akka? (eg. architecturally, if it does)
Vagif Abilov
@object
@mitchtbaum Akka.NET is a port of Akka so it has the same architectural principles. The difference is in ecosystem, use of external libraries etc.
Mitchell Tannenbaum
@naturallymitchell
@object Thank you.
Vagif Abilov
@object
@mitchtbaum moreover, the port is rather accurate in use of terms, naming, configuration so it's possible to discuss Akka-related topics with developers of both communities.
jalchr
@jalchr
@Aaronontheweb thanks for detailed explanation and the valuable video.
I understand the complexity of the problem. I'll try to port this sample to akka.net and see how things go: http://proto.actor/blog/2017/06/24/money-transfer-saga.html
Jose Carlos Marquez
@oeaoaueaa
hi, is anyone available to review the pull request AkkaNetContrib/Akka.DI.Ninject#10 ?
jameswilddev
@jameswilddev
Hello! Does TestScheduler have any mechanism for emulating a failure to deliver the message sent by ScheduleTellOnceCancelable/etc?
Arjen Smits
@Danthar
@jameswilddev no, if you want to be sure its delivered (it will be send to the IActorRef you tell it to, but that actor might not receive it because its remote), you will have to use mechanisms like AtLeastOnceDelivery. So instead of directly sending it to the remote actor (assuming here) you put an atleastoncedelivery actor in between or something.
Or whatever other reliable delivery mechanism you want to use
So what im saying is: emulating a failure to deliver by the Scheduler, is the wrong place to be handling this.
jameswilddev
@jameswilddev
Ah, thanks. In this case, it is just sending a message to itself.
I guess I should mock out the scheduler itself, check that it sends that message, and then test that when the message is received (or not received) that it acts accordingly.
jameswilddev
@jameswilddev
Is it specified anywhere what the scheduler will do if I start a repeating tell and then the actor which started it crashes (or otherwise stops)? Will it just schedule messages until the node is restarted (it seems this is the case from my testing)?
Vagif Abilov
@object
Hello. I remember being recommended to put actor initialization logic in PreStart (such recommendation is also contained in Akka Bootcamp). What are the reasons for that except that before PreStart is called, an actor is not yet capable of receiving messages? For example, if an actor creates some child actors can the child creation logic be executed prior its PreStart? What can go wrong?
Aaron Stannard
@Aaronontheweb
@oeaoaueaa I'll take a look at it
Jose Carlos Marquez
@oeaoaueaa
thanks!
Aaron Stannard
@Aaronontheweb
left you a comment on there
just need to add multi-targeting back to the csproj file
Jose Carlos Marquez
@oeaoaueaa
thanks, I'll correct that now
mmansouri
@mmansouri
Hello all, newbie question , where to put hocon config when using asp net core thanks
Aaron Stannard
@Aaronontheweb
@mmansouri what I'm doing is putting the HOCON in its own text file
and then executing the following
/// <summary>
    ///     Used to load HOCON definitions from a dedicated HOCON file
    /// </summary>
    public static class HoconLoader
    {
        /// <summary>
        ///     Parses a HOCON <see cref="Config" /> object from an underlying file
        /// </summary>
        /// <param name="path">The path to the HOCON file.</param>
        /// <returns>A parsed <see cref="Config" /> object.</returns>
        public static Config FromFile(string path)
        {
            return ConfigurationFactory.ParseString(File.ReadAllText(path));
        }
    }
similar to how you'd use a .JSON file for Microsoft.Extensions.Configuration
and then I pass that hocon object into the ActorSystem.Create(string name, Config config) method
we'll probably add something to Akka.NET core to make that easier soon
mmansouri
@mmansouri
ok thanks :smile: i will try this
Aaron Stannard
@Aaronontheweb
you'll want to set the text file to be treated as Content by MSBUILD
and then set it to Copy Always or Copy If Newer
mmansouri
@mmansouri
yeah an easier way to manage hocon in net core will be awesome
Jose Carlos Marquez
@oeaoaueaa
@Aaronontheweb PR updated: AkkaNetContrib/Akka.DI.Ninject#10 will bear that in mind next time
AnchishkinAlex
@AnchishkinAlex
@Aaronontheweb Hi! Thanks again for support yesterday! It works! There is another one problem with Akka.NET Remote.
I suppose it's enum serialization problem. We're expecting from remote actor enum return type but it returns long. (Of course Sender.Tell(EnumType))
Actor.Ask<EnumType>() //InvalidCastException
Google says about Akka.Cluster only. Is it right way for fixing this problem?
Bartosz Sypytkowski
@Horusiath
@AnchishkinAlex probably some problem with serializer. You may need something non-standard.
@object sometimes there are actors, that are not fully initialized at the end of the constructor call i.e. ReceiveActor doesn't have it's handler behavior compiled yet, PersistentActor didn't trigger recovery procedure. PreStart is not always mandatory, but it's a good rule of thumb
AnchishkinAlex
@AnchishkinAlex
@Horusiath does it mean asking of actor for EnumType is non-standard? For example, is it better to create Message class with Enum field?
Bartosz Sypytkowski
@Horusiath
@AnchishkinAlex I mean, you may try to use custom serializer for the enum type. Usually actors exchange more complex messages, afaik enum field in complex object should be deserialized correctly
AnchishkinAlex
@AnchishkinAlex
@Horusiath ok. I asked it because this problem occurs only with remote actor. Actors from one actor system can return enum type without exception. So I need explore near custom deserialization and serialization?
Bartosz Sypytkowski
@Horusiath
yes, messages exchanged between actors on the same node are not serialized.