Any trick to sending email from within an actor? I'm using SMTPClient and I'm temporarily abusing NUnit a little to actually send out emails for real from within my actor as part of the test as a quick way of verifying the contents are what I expect (I'll fake the email send later). The problem is that I get an SMTPException with an inner exception of ThreadAbortedException.
@qwoz the ThreadAbortedException usually comes from the test runner
when cleaning up the actors
when I've had to do this stuff before I just had an actor who would queue "email messages" out onto a queue
that would get scooped up by another process and delivered in batch
but that was kind of a special case with how I had to deliver them
(wasn't really over email - just a similar notification system)
what I would do in your case
is create a wrapper around the SMTPClient
can be a thin one
and then unit test with a mock / fake version of that wrapper class
that way you're not live-firing emails during testing
hm... I'm using SmallestMailboxPool over the actor that sends out emails to have a bunch available. That actor simply does:
Receive<Email>(email => // SMTPClient stuff here );
so I'd think it wouldn't actually finish and clean up the actor prior to that call completing.
is the SMTP connection persistent?
or is it something you need to open / close per-request
not persistent... it connects to the server for each email send.
yeah I'd just have the actor fire up a new client on each request like you're doing then
so this is probably some NUnit incompatibility that I'll just need to work around by mocking it for now. I wanted to be able to see in my email account that the email is actually formatted the way I want since the piece that actually uses this isn't fully implemented yet.
the joys of prototyping :smile:
@Aaronontheweb does using code contracts put any constraints on cross platform compatibility? I.e running on mono.
not as far as I know
we use them in NBench / Helios / DotNetty
all of those can run on Mono
Hi I'm using the Supervisor to catch the exception. But How can I get the message in Supervisor so that I can re
Hi I'm using the Supervisor to catch the exception. But How can I get the message in Supervisor so that I can re-read the message again? thank you.
@Silv3rcircl3 thank you. i read it later. I'm writing the demo with books.
@artem-karnaukh which version of Akka.Cluster.Sharding are you using? Also what steps have you made before an error occurred (maybe hard/graceful shutdown of a node)?
@Horusiath hey, thanks for the response. I ve just updated from 1.6 to the latest beta and everything works just fine. Thanks a lot for the amazing sharding module.
I have some questions about Akka.NET and cluster routers. Hope someone can help me clear things up...
As far as I understand it, in order to pass messages between nodes in a cluster, the message must go through a a cluster-aware router. Correct?
And for that I can either use a group or pool router. Difference is that the group router sends the mesasge to predifned routees that might or might not exist at the target node. The pool router on the other hand deploys its routees on the target node. Correct?
For deciding where to route message (and in case of pool router, deploy routees), the use-role property in the cluster part of the deployment config is used. Correct?
@peter-bannerflow 1: A cluster-aware router is a piece of infrastructure that makes it easier for you to communicate with the cluster as a whole. It adds a level of abstraction. You can communicate with nodes in your cluster directly if you want. But in order to do this properly you'd end up rebuilding alot of the management stuff that a cluster aware router already does for you. But if the out-of-the-box (OOB) cluster routers dont fit your use-case. You can certainly do this. 2: Yes 3: Yes
@Danthar ok, thanks for verifying my assumptions
What about if I pass an IActorRef in a message to some other node in the cluster, will an actor receiving that message be able to send a direct message to that IActorRef?