These are chat archives for petabridge/akka-bootcamp

8th
Jan 2016
Aaron Stannard
@Aaronontheweb
Jan 08 2016 03:09
@/all new blog post for you bootcamp folks - https://petabridge.com/blog/intro-to-persistent-actors/ Introduction to Akka.Persistence
Olivier Mühring
@fysicus
Jan 08 2016 10:20
This message was deleted
Olivier Mühring
@fysicus
Jan 08 2016 12:37
It's becoming rather annoying, but hey...
Olivier Mühring
@fysicus
Jan 08 2016 12:47

I have 2 actor systems running seperate in 2 modules, at creation i use the following configuration:

var  configString = @"akka
                     {
                         # here we are configuring log levels
                          log - config - on - start  off
                          stdout - loglevel = INFO
                          loglevel = ERROR

                          # this config section will be referenced as akka.actor
                          actor
                          {
                              provider = ""  Akka.Remote.RemoteActorRefProvider, Akka.Remote ""
                               debug
                               {
                                   receive = on
                                    autoreceive = on
                                    lifecycle = on
                                    event-stream = on
                                    unhandled = on
                               }
                          }
                     }

                    # here we're configuring the Akka.Remote module
                     remote
                     {
                         helios.tcp
                          {
                              transport-class = ""  Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote""
                               #applied-adapters = []
                               transport-protocol = tcp
                               port = " + _hostPort + @"
                               hostname = """ + _hostName + @"""
                          }

                          log-remote-lifecycle-events = INFO
                     }" ;

Off course _hostName and _hostPort are different in both modules (hostname = localhost, port = 8091 or 8092 depending on the module).

Then at some point I send a message from module 2 to module 1, like this:

try
{
   var actorHost = CloudConfigurationManager .GetSetting(name: "ForemanHost");
   var actorPort = CloudConfigurationManager .GetSetting(name: "ForemanPort");
   var actorPath = $"akka.tcp://Foreman@{actorHost. Trim()} :{actorPort. Trim()} /user/Dispatcher/Coordinator";

   Trace.TraceInformation ($ "SixthGear.Engine.Handler - Sending a message to {actorPath}");

   var foremanRef = Context .ActorSelection(actorPath);
   var timeSpan = new TimeSpan (0, 0, 5);
   try
   {
      var CheckReference = foremanRef .ResolveOne(timeSpan);
      foremanRef.Tell (new AzureRequestResult
      {
         OriginalRequest = request ,
         SuccessFull = processingSucceeded,
      });

   }
catch ( Akka.Actor .ActorNotFoundException e)
{
   Trace.TraceInformation ($"Coordinator not found.");
}

Everything seems to work fine, I can run (in debug) through every statement, but then when I'm waiting for my next break point to fire (when the message is receiverd by the other actor) I get the following error:

alt

Does anyone know what I'm doing wrong?

Bartosz Sypytkowski
@Horusiath
Jan 08 2016 12:55
@fysicus var actorPath = $"akka.tcp://Foreman@{actorHost. Trim()} :{actorPort. Trim()} /user/Dispatcher/Coordinator"; - space between {actorHost. Trim()} and : sign
also another one after {actorPort. Trim()}
Olivier Mühring
@fysicus
Jan 08 2016 12:56
But I already .Trim() the settings? I don't see a space :-/
Bartosz Sypytkowski
@Horusiath
Jan 08 2016 12:57
$"akka.tcp://Foreman@{actorHost. Trim()}here:{actorPort. Trim()}here/user/Dispatcher/Coordinator"
Olivier Mühring
@fysicus
Jan 08 2016 13:00
@Horusiath Strange, I can see the space when I paste the code in notepad, but not in Visual Studio
Bartosz Sypytkowski
@Horusiath
Jan 08 2016 13:06
@fysicus can you paste what actorPath has been generated?
Olivier Mühring
@fysicus
Jan 08 2016 13:13
@Horusiath akka.tcp://Foreman@localhost:8091/user/Dispatcher/Coordinator
Fixed the space issue, but still...
The strange thing is I'm not always getting the same error.
Usually it complains about the host name, but a couple of times I got an ActorNotFoundException
Bartosz Sypytkowski
@Horusiath
Jan 08 2016 13:15
@fysicus maybe you have this project on github and could share the link?
Olivier Mühring
@fysicus
Jan 08 2016 13:24
Unfortunately it's on visualstudio.com. :( Since it's not my application... Otherwise I would love your in put
What would I have to do to wait for var CheckReference = foremanRef .ResolveOne(timeSpan);
I'm pretty certain the exceptions I'm getting are a result of it being run async...
Bartosz Sypytkowski
@Horusiath
Jan 08 2016 13:26
all akka communication is basically async
ResolveOne is just blocking
Olivier Mühring
@fysicus
Jan 08 2016 13:28
Yes, I commented out ResolvedOne() and I still get the error. :-/
Bartosz Sypytkowski
@Horusiath
Jan 08 2016 13:30
how are your running your application? console/web/azure-worker?
Horusiath @Horusiath brb
Olivier Mühring
@fysicus
Jan 08 2016 13:30
Azure-worker
Olivier Mühring
@fysicus
Jan 08 2016 13:35
Then I still have a config problem I guess. :-/ I just don't see where I'm going wrong.
Sean Gilliam
@sean-gilliam
Jan 08 2016 20:25

@fysicus it looks like you have extra quotes around your hostname entry

this

hostname = """ + _hostName + @"""

should be this

hostname = " + _hostName + @"

Maciek Misztal
@mmisztal1980
Jan 08 2016 23:30
@Aaronontheweb @Horusiath I've read the latest petabridge blog entry - nice one. I have a question about snapshots. It seems to me, that moving to Akka.Persistence cuts the ties to an ORM I'd typically use? If I understood the samples correctly, all persistence is handled by Akka.Persistence? Am I allowed to handle the SnapshotOffer events by providing my own Repository implementation? It seems to me that I'd be giving away things that I've learned to apreciate - like entity validation etc. Any comments?
Olivier Mühring
@fysicus
Jan 08 2016 23:39
@sean-gilliam Thanx. You know, a lot of the akka .NET examples are confusing. Or at least, they could do with a bit more information