These are chat archives for akkadotnet/akka.net

17th
Feb 2017
Arjen Smits
@Danthar
Feb 17 2017 07:42
@ShamsulAmry Yup. that is one way. Thats the easiest way. However if you feel that creating a separate infrastructure for doing multi-tenant pub/sub is a better fit. By all means. Do so. There is no obvious right or wrong here.
Shamsul Amry
@ShamsulAmry
Feb 17 2017 07:54
@Danthar Thanks. Asked in case I will be losing out on any features I didn't know about if I used new EventStream() for each tenant instead of using the one pre-created with the ActorSystem.
Голодный Монстр
@Kalinin_Aleks_twitter
Feb 17 2017 08:26
Hi all! I need help! I have the problem with "EndpointDisassociatedException". If I do restart remote actor I am receiving the message in logs:
[akka://ARS-Runner-System/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fARSSystem%40127.0.0.1%3a2551-1] Association with remote system akka.tcp://ARSSystem@127.0.0.1:2551 has failed; address is now gated for 5000 ms. Reason is: [Akka.Remote.EndpointDisassociatedException: Disassociated
at Akka.Remote.EndpointWriter.PublishAndThrow(Exception reason, LogLevel level)
at Akka.Remote.EndpointWriter.Unhandled(Object message)
at Akka.Actor.ActorCell.<>cDisplayClass109_0.<Akka.Actor.IUntypedActorContext.Become>b0(Object m)
at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
at Akka.Actor.ActorCell.ReceiveMessage(Object message)
at Akka.Actor.ActorCell.AutoReceiveMessage(Envelope envelope)
at Akka.Actor.ActorCell.Invoke(Envelope envelope)]
And I can't catch this Exception for restarting the system because it is not "RemotingLifecycleEvent" and internal Exception. How can I handle the error? Thanks
Arjen Smits
@Danthar
Feb 17 2017 08:39
@Kalinin_Aleks_twitter The Exception is normal. It happens when the remote node becomes disassociated. This can happen for various reasons.
if you want to be notified when that happens
you can use the local system.EventStream to subscribe to AssociationErrorEvent
Голодный Монстр
@Kalinin_Aleks_twitter
Feb 17 2017 08:45
Yes, but as I can understand in my case was invoked PublishAndThrow(Exception reason, LogLevel level, bool needToThrow = true) which is trying to publish "DisassociatedEvent". Am I wrong?
So I should do subscribe to DisassociatedEvent
Arjen Smits
@Danthar
Feb 17 2017 08:49
The log shows the fact that you Disassociated. Internally this is communicated via the EndpointDisassociatedException exception. My guess is that you are getting this on the sender side ?
Thickar
@Thickar
Feb 17 2017 10:50
Hi there, I want to connect an SQLDateReader object as source Enum for Akka streams source, but i cant figure out how! could any one help?
Ralf
@Ralf1108
Feb 17 2017 12:35
is it possible to check if there are messages in the stash?
Maxim Cherednik
@maxcherednik
Feb 17 2017 12:35
why do you want to do this? :)
Ralf
@Ralf1108
Feb 17 2017 12:36
because i am a little confused :D
i have an actor... which gets a message. the actor is changing state and start processing stuff. because the original message can not be answered yet I stash it
when the processing is finished then all messages are unstashed and actor switches back to orginal state
now the original message can be answered
this works
but i also added passivation to the actor
so if the passivate message arrives during processing .. the passivate message will be handled and actor is shutdown
the orginal sender wont get a nice repsonse.. but instead could deathwatch the actor :-(
so if i could check if there are currently stashed messages i would also stash the passivate message... that should work
does this makes sense?
i could keep track of stashed messages count by myself. wondered if the count or "not empty stash" could be checked
maybe using reflection :P
Maxim Cherednik
@maxcherednik
Feb 17 2017 12:41
just thinking what I would do
what is this passivation message? what do you mean by this?
Arjen Smits
@Danthar
Feb 17 2017 12:42
Its a pattern
Ralf
@Ralf1108
Feb 17 2017 12:42
yes, i implemented it like this.
parent sent passivate to child and stops forwarding messages to child
child stops it self when nothing doing anything else
parent gets informed via deathwatch
Arjen Smits
@Danthar
Feb 17 2017 12:44
@Ralf1108 what you can do. Is once you receive the passivate message
unstash all messages, then send the passivate message to yourself again. Basically forward it. Because you also change the state of your actor (switching from processing to the other state).
You could have the passivate message be handled differently
so if your in processing and receive a passivate. Unstash and forward passivate message to yourself
then all stashed messages get handled
Ralf
@Ralf1108
Feb 17 2017 12:45
i get the idea
Arjen Smits
@Danthar
Feb 17 2017 12:45
:+1:
Ralf
@Ralf1108
Feb 17 2017 12:46
i think it would be enough to just stash the passivate message when in the processing state
Arjen Smits
@Danthar
Feb 17 2017 12:46
thats also possible.
Ralf
@Ralf1108
Feb 17 2017 12:46
when processing is finished... unstash all moves original message first and then passivate message into mailbox
so normal workflow occurs
thx guys for helping out !!! :+1:
Arjen Smits
@Danthar
Feb 17 2017 12:47
np
@maxcherednik passivate is a pattern used to reduce the amount of idle actors in your topology
imagine you have an actor per user in your system
and your routing messages to those user actors
you would have an coordinator as the parent of those user actors
which receives user messages and forwards them to the correct actor
then, depending on a strategy of your own making
for example a timeout
lets say that once a user actor has not seen a message in X amount of time
you want to stop it, so its state is unloaded from memory
the coordinator sends a passivate message to the user actor and starts buffering messages for that actor
actor stops, deathwatch notifies the coordinator
if the coordinator receives messages for that user again
it starts up the actor again
and forwards the message once the actor is up
this kind of pattern is very useful if you have a large pool of stateful actors which only occasionally receive messages.
Arjen Smits
@Danthar
Feb 17 2017 12:54
Cluster Sharding uses passivate
Ralf
@Ralf1108
Feb 17 2017 12:54
i like this pattern. it allows to manage thousands of actors and only the hotspot actors which are currently in use will be available in memory. similar to a garbage collector
Maxim Cherednik
@maxcherednik
Feb 17 2017 12:55
@Danthar I see. Thx. Just never used it.
I am just wondering why don't I have this logic inside the Actor based on timeout - stop self...
then once new message arrives - the parent will just create it again and send the message to it
why do I need to use some kind of buffering or what so ever
Arjen Smits
@Danthar
Feb 17 2017 12:58
because actor shutdown is async
the Terminate message is just that. A message
Maxim Cherednik
@maxcherednik
Feb 17 2017 12:58
ah
right
Arjen Smits
@Danthar
Feb 17 2017 12:59
so you want to buffer to account for race conditions
Maxim Cherednik
@maxcherednik
Feb 17 2017 13:00
nowadays, I am trying to offload all the logic like this to the client :) Shutdown - async? ok that will skip the next message, client will retry on timeout :)
Arjen Smits
@Danthar
Feb 17 2017 13:02
Thats a choice. Depending on your architecture it might be enough. Although when communicating across the network, if you want reliable delivery, you always end up with that kind of stuff
but the upside is. It can be abstracted away pretty easily
Maxim Cherednik
@maxcherednik
Feb 17 2017 13:02
I see
Arjen Smits
@Danthar
Feb 17 2017 13:03
"with that kind of stuff" i mean the thing you mentioned. Namely implement retries client side
Maxim Cherednik
@maxcherednik
Feb 17 2017 13:03
btw do you always do this?
Arjen Smits
@Danthar
Feb 17 2017 13:03
nope
Dont always need guarenteed delivery
And it depends on what your doing
Maxim Cherednik
@maxcherednik
Feb 17 2017 13:04
it's kind of a boiler plate code... which you need to implement on every request response
of course if it's a UI call.... I will ask UI guys to timeout and push user to request it again
Jose Carlos Marquez
@oeaoaueaa
Feb 17 2017 13:32
hi, whats the approach for a cluster of servers with a "flaky" network connection where some of the nodes are marked as Unreachable? should those nodes restart themselves? if so, how do they know?
Francis Paulin
@paulinfrancis
Feb 17 2017 13:52

I've got two console apps that both connect successfully to lighthouse to join a cluster. I would like to publish messages from actors in one console app to actors in the other.

In the "from" console app

var mediator = DistributedPubSub.Get(_actorSystem).Mediator;
mediator.Tell(new ClusterClient.Publish("topic-foo", "my message"));

In an actor in the "to" console app

public RaspberryPiActor()
{
    var mediator = DistributedPubSub.Get(Context.System).Mediator;
    mediator.Tell(new Subscribe("topic-foo", Self));
    Receive<SubscribeAck>(_ => Become(Subscribed));
}

private void Subscribed()
{
    Receive<string>(m =>
    {
        Console.WriteLine(m);
    });
}

Am I doing something that is evidently wrong?

Francis Paulin
@paulinfrancis
Feb 17 2017 14:00
All the messages go straight to dead letters.
Jose Carlos Marquez
@oeaoaueaa
Feb 17 2017 14:01
what type is the result of: new ClusterClient.Publish("topic-foo", "my message")?
from what I understand, that is the message that is being sent
Francis Paulin
@paulinfrancis
Feb 17 2017 14:07
blob
Jose Carlos Marquez
@oeaoaueaa
Feb 17 2017 14:11
I think you might be receiving a message of type "Publish", try Receive<Publish>(p => ....) instead
Francis Paulin
@paulinfrancis
Feb 17 2017 14:22
No luck I'm afraid, but thanks for the suggestions!
Tried ReceiveAny too, just to be on the safe side
but it never hits the method
Arjen Smits
@Danthar
Feb 17 2017 14:33
@paulinfrancis you are using the wrong Publish message
you should use the Akka.Cluster.Tools.PublishSubscribe.Publish message type
Sean Farrow
@SeanFarrow
Feb 17 2017 18:08
Hi, I'm in a situation where I'm converting code to use actors for fault tolerance. I have a method that returns a stream, can messages return streams, or should I convert this to a byte array?
Bartosz Sypytkowski
@Horusiath
Feb 17 2017 18:28
@SeanFarrow in general messages shouldn't use any disposable resources
Sean Farrow
@SeanFarrow
Feb 17 2017 18:37
Hi, thanks, I'll convert the stream to a byte array then.
Rich Cox
@conejo
Feb 17 2017 19:59
I have 2 questions: 1. Does Watch work with actors in the /temp hierarchy? 2. Do messages sent to an actor in the/temp hierarchy get sent to deadletters after they are killed?
Arjen Smits
@Danthar
Feb 17 2017 21:40
@conejo 1: Theoretical yes. But why? 2: yes
Rich Cox
@conejo
Feb 17 2017 21:45
@Danthar I'm using .Ask in a Nancy controller, and using a timespan for a timeout. I was trying to figure out how to get notified if the .Ask temp actor was killed or a message was sent to it after it was killed
Arjen Smits
@Danthar
Feb 17 2017 21:46
a temp actor that gets created because of the Ask construct lives only as long, up untill the point it timeouts, or a response message is returned
watching it is pointless
its better to let the client simply retry if it timeouts
Rich Cox
@conejo
Feb 17 2017 21:48
I agree on the retry, no problem there. However the controller action is not idempotent, if the result cant get returned to the client because it timed out, it needs to be undone
I made an actor to listen to the DeadLetter event stream, and subscribed it to the stream (typeof(DeadLetter)), but it's not receiving any
So, I've come up with an alternate strategy to use .Ask without a timeout (it will wait forever), and rely on ScheduleTellOnce to send a timed out notification
Chris G. Stevens
@cgstevens
Feb 17 2017 23:12
What changes should I make to fix the following issue. My cluster of 10 members run fine with no unreachable issues. When I join the Cluster from my laptop which is on a different network segment and domain I get unreachable messages. Not all the time. But enough to cause disruption where other members can't join.