These are chat archives for akkadotnet/akka.net

4th
Aug 2015
jberzy
@jberzy
Aug 04 2015 00:02

otherwise you have to handle the wildcard case i.e.:

match o with | JObj x -> .... | _ -> ....

Kyle Gobel
@KyleGobel
Aug 04 2015 00:16
what is recommended way to handle blocking calls in an actor? let them block, or wrap in a task or something? Is there some magic keyword to find info about this in the docs?
Aaron Stannard
@Aaronontheweb
Aug 04 2015 00:17
hi @KyleGobel - if it's a long-running task then yes, I'd wrap it in a Task and use PipeTo to pipe the result back to the actor
hmmm... yeah our doc search is a little rigid at the moment, isn't it?
your question would be appropriate for an FAQ
or best practices
Kyle Gobel
@KyleGobel
Aug 04 2015 00:23
Thanks Aaron
Joe Flood
@jfloodnet
Aug 04 2015 06:53
@Aaronontheweb did you have any luck with running a cluster in azure worker roles? RE: this conversation https://gitter.im/akkadotnet/akka.net/archives/2015/07/18
Hyungho Ko
@hhko
Aug 04 2015 10:45
how to use "Context.System.Scheduler.ScheduleTellRepeatedly" for pausing or resuming?
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 11:00
@hhko there is no such thing. You have schedule/cancellation only
you may build rest on top of that
Kamil Wojciechowski
@aph5nt
Aug 04 2015 11:53
Question: Is it possible to have a remote (cluster) PersistantView that will read from the events of an actor on a different machine?
welshtom
@welshtom
Aug 04 2015 11:54
Hi guys, i'm trying to get the "hello world" example running but I get "Could not load type 'Akka.Actor.ActorSystem' from assembly 'akka, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'." everytime i try to run it
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 11:55
@aph5nt persistent view synchronizes with persistent actor through journal (and underlying persistent backend), not with each other
@welshtom did you get Akka.NET from NuGet?
welshtom
@welshtom
Aug 04 2015 11:56
yes nuget :)
1.0.3.11
I did uninstall it and request 1.0.0.0 but it made no difference
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 11:57
it doesn't look so, you have 1.0.0 here, while current version is 1.0.3 (1.0.4 will come out this week), also token shouldn't be null and akka is writen with capital letter
welshtom
@welshtom
Aug 04 2015 11:59
akka was just my namespace
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 12:03
so you've probably messed .NET trying for use two assemblies with the same name in one project
:P
welshtom
@welshtom
Aug 04 2015 12:06
I will recreate it
installed from nuget
that's weird it has worked! thank you
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 12:13
np, have a fun :)
foo bar code
@lepinay
Aug 04 2015 12:25
@Horusiath from what i've been reading you gys managed to fix th DU issue, that's cool :)
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 12:26
@lepinay yes, fix is on PR, but I need to move it to persistence plugin as well
foo bar code
@lepinay
Aug 04 2015 12:29
@Horusiath thanks, I'll give it a try once it's merged
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 12:29
no worry, I've tested it on your example :P
foo bar code
@lepinay
Aug 04 2015 12:34
:+1:
Suhas Chatekar
@schatekar
Aug 04 2015 13:54
When I try to build the code, I get following error. Do I need to install anything related to FSharp?
   "E:\Source\akka.net\src\Akka.sln" (Rebuild target) (1) ->
   "E:\Source\akka.net\src\examples\FSharp.Api\FSharp.Api.fsproj" (Rebuild target) (5) ->
     E:\Source\akka.net\src\examples\FSharp.Api\FSharp.Api.fsproj(79,3): error MSB4102: The value "" of the "Project" attribute in element <Import> is invalid. Parameter "path" cannot have zero length.
I have installed FSharp
But I am still facing the issue with Fsharp. MsBuild variable MSBuildExtensionsPath32 not having a correct value could be the root cause in my case. I have tried setting up a environment variable with the same name hoping it would override the MsBuild variable but that does not work
Nikita Tsukanov
@kekekeks
Aug 04 2015 14:40
You need FAKE deps
Recent VS and recent F#
use build.fsx
Suhas Chatekar
@schatekar
Aug 04 2015 15:23
I have VS2013 and F# 4.0. does that work?
I am running build all from command line
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 15:23
better try build build, all sometimes has problems
Suhas Chatekar
@schatekar
Aug 04 2015 15:27
ok, so build works and build runtests is running
Aaron Stannard
@Aaronontheweb
Aug 04 2015 15:54
@Horusiath I'm going to push the release of v1.0.4 back a day - I want to get the DU fix in but it'll also take a bit of time to get all of the CI stuff squared away for each of the individual Akka.Persistence implementations
won't be able to get started on the Akka.Persistence stuff until ~1pm or so PST today
so I'm thinking a release tomorrow morning PST
@jfloodnet only in the emulator (works great there) thus far - there's something different about the way it's run in production that's stopping the web roles from being able to connect to the worker roles and I don't understand why
Aaron Stannard
@Aaronontheweb
Aug 04 2015 15:59
judging by the fact that I'm not seeing any logs at all appear in System.Trace / azure diagnostics I'm wondering if the way it starts roles is fundamentally different in the emulator
the other thing I don't get is that suddenly my web roles stopping logging to trace also, even though they run fine - and they even stopped writing to trace in the emulator
I haven't done anything ostensibly different to that role to make such a change
I'm astonished that cloud services still have these sorts of weird problems; it was that way when I was evangelizing Azure for MSFT back in 2010-2012 :p
jberzy
@jberzy
Aug 04 2015 16:03
@Aaronontheweb You're calling the management api to configure the ports inside the worker role, correct?
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:03
yessir
I have the OnStart method block until at least 1 node of a specific role is up
and then I use the IPEndPoint of a named internal endpoint to work as my seed node
jberzy
@jberzy
Aug 04 2015 16:05
ok, maybe it's not an issue then. I was just going to say that a lot of the calls to configure things in azure will return before the 'job' is actually complete. but I guess you're not basing your code on that...
i.e. you need to make another call to check the operation status
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:08
I'll pull up the code real quick
might be something obvious that I'm missing
 public static class AzureRuntimeBootLoader
    {
        public static async Task<Config> CreateRuntimeConfig(string seedRoleName, string akkaEndpoint)
        {
            // Need to wait until at least 1 instance of our seed role is up and available
            while(!IsSeedRoleAvailable(seedRoleName))
            {
                await Task.Delay(TimeSpan.FromSeconds(1.5));
            }

            return CreateConfig(seedRoleName, akkaEndpoint);
        }

        public static bool IsSeedRoleAvailable(string seedRoleName)
        {
            if (!RoleEnvironment.Roles.ContainsKey(seedRoleName))
                throw new ArgumentException("Undefined role " + seedRoleName + " in Azure service definition");
            return RoleEnvironment.Roles[seedRoleName].Instances.Any();
        }

        private static Config CreateConfig(string seedRoleName, string akkaEndpoint)
        {
            var section = (AkkaConfigurationSection)ConfigurationManager.GetSection("akka");
            var clusterConfig = section.AkkaConfig;

            var selfAzureAddress = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints[akkaEndpoint];
            var selfAkkaAddress = selfAzureAddress.IPEndpoint.Address;
            var selfPort = selfAzureAddress.IPEndpoint.Port;
            var seedNodes = new List<string>();

            var trackerRoles = RoleEnvironment.Roles[seedRoleName].Instances;
            foreach (var trackerEndpoint in trackerRoles.Select(x => x.InstanceEndpoints[akkaEndpoint]))
            {
                seedNodes.Add(string.Format(@"""akka.tcp://{0}@{1}:{2}""", "webcrawler", trackerEndpoint.IPEndpoint.Address, trackerEndpoint.IPEndpoint.Port));
            }

            var remoteConfig = ConfigurationFactory.ParseString(string.Format(@"akka.remote.helios.tcp.public-hostname = ""{0}"" 
            akka.remote.helios.tcp.port = {1}", selfAkkaAddress, selfPort));
            var clusterSeedConfig = ConfigurationFactory.ParseString(string.Format(@"akka.cluster.seed-nodes = [{0}]", string.Join(",", seedNodes)));
            var finalConfig = clusterSeedConfig.WithFallback(remoteConfig).WithFallback(clusterConfig);
            return finalConfig;
        }
    }
I use this code for all three roles inside WebCrawler
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:13
hmmm... you know what I just realized... theRoleEnvironment.Roles collection,when I was debugging it in the emulator, appeared as though it was dynamically populated at runtime
which is why I designed the class this way
jberzy
@jberzy
Aug 04 2015 16:13
yeah, i was just going to mention that
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:14
could it be possible that in production it's statically populated, and instead of blocking on this I have to wait until I can send some signal that that role is available?
jberzy
@jberzy
Aug 04 2015 16:14
I think the IsSeedRoleAvailable call will always return true
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:15
so would it be correct to say that the way IsSeedRoleAvailable is going to behave differently in the emulator than in production?
jberzy
@jberzy
Aug 04 2015 16:15
well it might just be that that race condition doesn't exist when running locally
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:15
yeah, that would explain it
the overhead of starting a VM doesn't exist
in the emulator
so in that case, I guess I'd need to be able to check to see if the status of those role instances is up?
rather than just assuming that being present in the RoleEnvironment.Roles means that it's up?
jberzy
@jberzy
Aug 04 2015 16:17
I think the issue with that is it might not actually indicate that the ports are configured.
I think your best bet is to actually define the ports in the configuration
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:18
I do that inside the cloud service definition
these are all internal endpoints that have specific ports
I also run a batch file that opens the firewall to receive inbound connections through those ports too before the role starts
although I'm not sure if that was necessary
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="WebCrawler.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
  <WorkerRole name="WebCrawler.CrawlService" vmsize="Medium">
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
    </ConfigurationSettings>
    <Endpoints>
      <InternalEndpoint name="Akka.Cluster" protocol="tcp" port="10101" />
    </Endpoints>
    <Startup>
      <Task commandLine="Startup\open-port.cmd" executionContext="elevated" taskType="simple">
        <Environment>
          <Variable name="EMULATED">
            <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
          </Variable>
        </Environment>
      </Task>
    </Startup>
  </WorkerRole>
  <WebRole name="WebCrawler.Web" vmsize="Medium">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" />
        </Bindings>
      </Site>
    </Sites>
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
    </ConfigurationSettings>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="http" port="80" />
      <InternalEndpoint name="Akka.Cluster" protocol="tcp" port="10090" />
    </Endpoints>
    <Startup>
      <Task commandLine="Startup\open-port.cmd" executionContext="elevated" taskType="simple">
        <Environment>
          <Variable name="EMULATED">
            <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
          </Variable>
        </Environment>
      </Task>
    </Startup>
  </WebRole>
  <WorkerRole name="WebCrawler.TrackingService" vmsize="Medium">
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
    </ConfigurationSettings>
    <Endpoints>
      <InternalEndpoint name="Akka.Cluster" protocol="tcp" port="9981" />
    </Endpoints>
    <Startup>
      <Task commandLine="Startup\open-port.cmd" executionContext="elevated" taskType="simple">
        <Environment>
          <Variable name="EMULATED">
            <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
          </Variable>
        </Environment>
      </Task>
    </Startup>
  </WorkerRole>
</ServiceDefinition>
is this what you mean @jberzy? Or should I be configuring those ports elsewhere in the app?
jberzy
@jberzy
Aug 04 2015 16:21
yeah. that's what I mean. looks good to me.
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:21
so it seems like the likely suspect here is a race condition with the roles actually being up and the service management API
but the fact that I don't get any logs from either of my worker roles is suspicious...
public class WorkerRole : RoleEntryPoint
    {
        protected ActorSystem ClusterSystem { get; set; }

        private readonly ManualResetEvent _runCompleteEvent = new ManualResetEvent(false);

        public override void Run()
        {
            Trace.TraceInformation("Crawler is running");
            try
            {
                this.Run(this._runCompleteEvent);
            }
            finally
            {
                this._runCompleteEvent.Set();
            }
        }

        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            var config = AzureRuntimeBootLoader.CreateRuntimeConfig("WebCrawler.TrackingService", "Akka.Cluster");
            ClusterSystem = ActorSystem.Create("webcrawler", config.Result);

            bool result = base.OnStart();

            Trace.TraceInformation("Crawler has been started");

            return result;
        }

        public override void OnStop()
        {
            Trace.TraceInformation("Crawler is stopping");

            this._runCompleteEvent.Set();

            base.OnStop();

            Trace.TraceInformation("Crawler has stopped");
        }

        private void Run(ManualResetEvent shutdownCalled)
        {
            while (!shutdownCalled.WaitOne())
            {
                ClusterSystem.Shutdown();
                ClusterSystem.AwaitTermination(TimeSpan.FromSeconds(5));
            }
        }
    }
jberzy
@jberzy
Aug 04 2015 16:25
I'm assuming for the logging you have the correct storage setup for the Release configuration?
i.e. you're not using developmentstorage=true
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:25
oh, maybe not - I've only been testing it in dev on the emulator
let me double check that
ServiceConfiguration.Cloud is pointing to a real storage account for all three services
so that looks good
jberzy
@jberzy
Aug 04 2015 16:27
you might want to take a look in the logs there
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:28
oh hey
jberzy
@jberzy
Aug 04 2015 16:28
they would be in the blob storage under a directory starting with 'wad' or something
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:28
you know what, found my logs for all three services
in the WADLogsTable
jberzy
@jberzy
Aug 04 2015 16:29
oh sweet
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:29
for some reason these didn't show up in the normal "diagnostics" view
but here they are
jberzy
@jberzy
Aug 04 2015 16:29
nice, that might help with the troubleshooting
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:29
EventName="MessageEvent" Message="[ERROR][7/25/2015 8:47:08 AM][Thread 0011][akka://webcrawler/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fwebcrawler%40100.116.48.19%3a9981-1] Invalid address: akka.tcp://webcrawler@100.116.48.19:9981
Cause: Akka.Remote.InvalidAssociation: Invalid address: akka.tcp://webcrawler@100.116.48.19:9981 ---> Akka.Remote.Transport.InvalidAssociationException: Association failure ---> Helios.Exceptions.HeliosConnectionException: Timed out on connect
at Helios.Net.Connections.TcpConnection.Open()
at Akka.Remote.Transport.Helios.HeliosTcpTransport.AssociateInternal(Address remoteAddress)
at Akka.Remote.Transport.Helios.HeliosTransport.<Associate>d__6.MoveNext()
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at Akka.Actor.ActorCell.HandleFailed(Failed f)
at Akka.Actor.ActorCell.SystemInvoke(Envelope envelope)" TraceSource="WaWorkerHost.exe"
from the tracker role...
jberzy
@jberzy
Aug 04 2015 16:30
hmmm is that supposed to be a private ip? Or are you binding to a public ip?
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:31
these should all be private
(it's what gets exposed on the internal endpoint)
so yeah, no node can connect to any other node is what it looks like
seeing this message for each service
good news is that all of the other roles are trying to connect to the correct seeds
all of these logs are occurring really close together too
within seconds of eachother
so I think that rules out a race condition
with roles booting up at vastly different times
seems more like a connectivity issue
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:36
@jberzy deployments in the same cloud service are able to connect via private IP, right?
jberzy
@jberzy
Aug 04 2015 16:36
yup, they're on the same subnet. that should work. All looks good to me.
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:37
oh hey, this is interesting
was just able to verify that the two tracker nodes can successfully cluster with eachother
saw that in the logs
jberzy
@jberzy
Aug 04 2015 16:38
weird. so within the same role they can cluster?
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:39
yeah
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:44
nope, nevermind
read that wrong in the log
it was a tracker marking itself as up
I wonder if the issue is my firewall script
REM Skip this startup task if we're running in the emulator
if "%EMULATED%"=="true" exit /b 0

@ECHO OFF
echo Opening internal endpoint
echo ---------------------------------------------------
netsh advfirewall firewall add rule name="Akka.Cluster" dir=in action=allow protocol=TCP localport=9981 >> log.txt 2>> err.txt
echo ---------------------------------------------------
echo Done
I've been able to RDP into the machines and view the logs that this produces
and view the firewall settings afterwards
which both look fine
I have a version of this script for each service that opens up its unique port
this is the script for my tracker nodes, the seeds in the cluster
jberzy
@jberzy
Aug 04 2015 16:52
I don't think you need that
for internal comm. atleast
I'm not positive though
so one thing I can verify by just going through the logs here is that all of the nodes are active and still trying to reconnect with eachother
but aren't able to
all of the nodes bind their sockets to 0.0.0.0 and set their public-hostname equal to the private IP
jberzy
@jberzy
Aug 04 2015 16:55
I think that might just be for vanilla VMs though... since you're running in a cloudservice I don't think you need that
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:55
yeah, that might be true
would be kind of stupid to define an endpoint on Azure and not have it work
automatically
jberzy
@jberzy
Aug 04 2015 16:55
yeah
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:55
(although, this is how Elastic Beanstalk works)
jberzy
@jberzy
Aug 04 2015 16:56
I got something like this working before
let me see if I can dig up the code
it was a long time ago
Aaron Stannard
@Aaronontheweb
Aug 04 2015 16:56
I got a self-clustering MongoDB + Node.JS app to run on a cloud service once
that was a bitch
someone else at MSFT figured out how to do all of this gory stuff - I just built a demo on top of it
MongoDB kept missing writes / reads though, even though there were only a very small number of them
couldn't tell if it was an issue with the azure setup or just Mongo being Mongo :p
(just kidding - was clearly a setup issue)
Aaron Stannard
@Aaronontheweb
Aug 04 2015 17:07
@jberzy so if it's not a firewall issue and it's not a race condition... what else might the problem be?
jberzy
@jberzy
Aug 04 2015 17:11
Yeah, at this point I'm not too sure.
Have you tried moving the code that establishes the connections to the Run() method instead of OnStart()
Aaron Stannard
@Aaronontheweb
Aug 04 2015 17:12
no, I haven't tried that yet
that's a good idea
jberzy
@jberzy
Aug 04 2015 17:12
just throwing it out there. no idea if it makes a difference.
jcwrequests
@jcwrequests
Aug 04 2015 17:13
@Danthar @SeanKilleen Thanks guys for your input. Sorry I did not get back sooner just finished moving and just got internet back up several hours ago. My first go was causing all kinds of weird connection issues with AWS SMS. I believe it's because I am using a single set of credentials with multiple instances of the smtp client. What I was thinking during my move was creating several sets of credentials then pooling them together to see if I could get around my problem. The only problem with that solution is I have to create a new set of credentials every time I want to expand the pool.
Aaron Stannard
@Aaronontheweb
Aug 04 2015 17:15
@jberzy I guess the other thing I could try is adding some telnet support :p
see if I can do that between the two boxes
because the lack of connectivity is pretty ubiquitious atm
jberzy
@jberzy
Aug 04 2015 17:17
yeah, that might help isolating the issue.
@Aaronontheweb Curious why the IP address is in the public ip range
the way you're accessing it looks correct, but shouldn't that give you a private ip address?
so I haven't been allowing ICMP traffic through the firewall
just modified my script to allow that
throwing something at the wall and seeing what sticks pretty much :p
I'll double check the IPs
doing a fresh deployment now
jberzy
@jberzy
Aug 04 2015 17:27
yeah, good luck with ICMP...
from what I remember they heavily restrict that
e.g. try pinging another vm from the other
probably won't work
Aaron Stannard
@Aaronontheweb
Aug 04 2015 17:35
yeah, these are public IPs
there's the problem
all of this traffic is going out to the load balancer
which has no corresponding endpoints
is there a way to get a per-VM view of an instance in a cloud service?
where I can actually view the private IP / public IP tuple for each instance?
Aaron Stannard
@Aaronontheweb
Aug 04 2015 17:40
nope, nevermind
PRIVATE IP ADDRESS
100.114.156.81
PUBLIC IP ADDRESSES
104.40.21.113
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 17:40
@Aaronontheweb I'll try to introduce a test for F# DU, but probably won't finish it today
Aaron Stannard
@Aaronontheweb
Aug 04 2015 17:41
@Horusiath no problem - we can wait. I'd rather have verification that this patch does the job
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 17:41
it requires true serialized message pass (such as binary-over-the-wire in akka.remote) to get the real verification
Aaron Stannard
@Aaronontheweb
Aug 04 2015 17:46
worth doing
@jberzy going with the nuclear option
turning windows firewall off
so I can rule it out
Aaron Stannard
@Aaronontheweb
Aug 04 2015 18:01
nope, not the firewall
it's something else
Kamil Wojciechowski
@aph5nt
Aug 04 2015 19:13
about F# PersistentView, there is not possibility to query it
override x.Receive (msg: obj): bool =
match msg with
| :? 'Event as e ->
state <- perspective.apply mailbox state e
true
| _ -> false // ignore?
i can build up the view
but there is no way of sending query command
line 264
is there a workaround for that ?
Roger Johansson
@rogeralsing
Aug 04 2015 20:48
@Horusiath do we have any red black tree impls in C# land? I recall seeing some message from you about it, but cant see that in the reported issue
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 20:53
@aph5nt can you create an query message that has type of 'Event?
@rogeralsing I've heard some comments saying, that ImmutableSortedDictionary is implemented as RB-tree, but then I've looked into source code, and it seems to be AVL (unless the code is missleading)
I don't want to go through example code found on some blog. I could roll something on my own, but I want to find some proven immutable library first.
jberzy
@jberzy
Aug 04 2015 21:05
it's AVL AFAIK
Kamil Wojciechowski
@aph5nt
Aug 04 2015 21:17
@Horusiath how about sth like this ?
override x.Receive (msg: obj): bool =
match msg with
| :? 'Event as e ->
state <- perspective.apply mailbox state e
true
| a -> perspective.receive mailbox state a
true
where receive is
type Perspective2<'Event, 'State> = {
state: 'State
apply: View<'Event, 'State> -> 'State -> 'Event -> 'State
receive: View<'Event, 'State> -> 'State -> obj -> unit
}
btw i did not test that
so thats only a conception
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 21:19
so how does it differ from present option?
Kamil Wojciechowski
@aph5nt
Aug 04 2015 21:22
in 1st option an apply function is for restoring state based on journal, right?
if yes, then quering view should be in a seperated function then
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 21:23
you may still split the apply function using simple wrapper over a view, it's not necessary to divide basically the same receive method in two - this is what has be done in persistent actors and is source of many problems in using F# with persistence (since now have an interface, not a function and we loose composability)
Kamil Wojciechowski
@aph5nt
Aug 04 2015 21:24
hmmm
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 21:25
in the views there is no separation between receive commands and receive recovery, since they're not persisting anything
Kamil Wojciechowski
@aph5nt
Aug 04 2015 21:25
so if I run " let state = view.Ask(Receive) |> Async.AwaitTask |> Async.RunSynchronously" then the Receive will be handled by the apply?
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 21:25
yes
Kamil Wojciechowski
@aph5nt
Aug 04 2015 21:25
it will not, because 'Event has different type
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 21:26
type is generic, it can be anything
Kamil Wojciechowski
@aph5nt
Aug 04 2015 21:27
ok, let me try
Bartosz Sypytkowski
@Horusiath
Aug 04 2015 21:28
if you will have some thoughts on that, don't hesitate to write them :) I'm going afk right now, but we can continue tomorrow
Kamil Wojciechowski
@aph5nt
Aug 04 2015 21:33
@Horusiath - ok. in general it works, so I will be return the state; but one thing that I do not like is that quering will have to return state
and it will update the current one
state <- perspective.apply mailbox state e
@Horusiath - talk to you tomorrow then, bye
it might actually be the firewall after all.
Actually.... I guess you already opened the port in the firewall like suggested in the answer.
damnit
Aaron Stannard
@Aaronontheweb
Aug 04 2015 22:47
I have an idea as to what the issue might be