These are chat archives for akkadotnet/akka.net

5th
Oct 2016
qwoz
@qwoz
Oct 05 2016 01:21
if I schedule a message that tells an actor to shut down itself, or set a receive timeout, what happens if a message gets sent to the actor right before that scheduled message or receive timeout calls Context.Stop(Self);?
or, more generally, how does one ensure if that an actor stops itself after some amount of time to free up resources, no messages are lost due to a race condition?
qwoz
@qwoz
Oct 05 2016 01:48
Looks like for clustering that's described here: http://getakka.net/docs/clustering/cluster-sharding#passivation
DON'T use Context.Stop(Self) on the entities, as this may result in losing messages.
For a non-clustered scenario, how should one avoid doing that without message loss?
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 07:14
@qwoz you may need to use gateway actor in front of the worker actors, which will buffer messages addressed to dead actors. Btw. you may also use cluster-sharding having a single node
Arjen Smits
@Danthar
Oct 05 2016 07:32
Made a PR for the sql repo to release 1.1.2. If someone can do a quick review and merge it. That would be nice. I also found out we dont have nightlies for the 1.1.2 of the sql plugin. Not sure why it didnt run...
qwoz
@qwoz
Oct 05 2016 08:12
@Horusiath is there an example of a gateway actor? Is this the pattern of having a FooManager which looks up or creates child Foo actors and forwards messages to them?
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 08:21
@qwoz yes + it also watches (Context.Watch(childRef)) over them, and when they send passivation message, it can buffer incoming messages, and if actor termination occurred and there were some buffered messages, it recreates it and forwards buffer to it
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 08:27
// on child actor termination 
Receive<Terminate>(t => {
    List<Tuple<obj, IActorRef>> buffer;  // msg content + msg sender
    // check if there are buffered messages for that actor
    if(_bufferedMessages.TryGetValue(t.ActorRef, out buffer) {
        // since original actor terminated, recreate it and watch (for future Terminate messages)
        var childRef = Context.Watch(Context.ActorOf(_childProps, t.ActorRef.Path.Name));
        // flush the buffer to new actor incarnation
        foreach(var msg in buffer) childRef.Tell(msg.Item1, msg.Item2); // send a message and set it's sender
        // remove the buffer
        _bufferedMessages.Remove(t.ActorRef);
    }
})
Arsene Tochemey GANDOTE
@Tochemey
Oct 05 2016 08:37
Hello gentlemen. is it possible to get the actor ref of the one that crashes in the supervisory strategy?
Also is it a bad practice to catch exception in Actor in their Receive methods?
John Nicholas
@MrTortoise
Oct 05 2016 08:44
Hi, long time no see. Back to akka for a bit. Couple of questions. 1) what is most sensible azure akka approach?
In fact that's it for now ...the rest depend on answer to that... I was thinking some kind of state full app fabric service?
If so the issue for that is a year old... Is it still the guy in that I should chat to about writing the persistence plug in?
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 08:48
@Tochemey supervisor strategy doesn't offer you that, it's more for determining how actor should behave based on type of the incoming exception solely
Arsene Tochemey GANDOTE
@Tochemey
Oct 05 2016 08:49
@Horusiath Do you think that it will be a nice feature to have? It can open more avenues on dealing with actors.
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 08:49
@MrTortoise I know that there are people using service fabric for akka cluster node discovery. I've tried myself, but service fabric api is too fucking irritating for me
@Tochemey from what I know within the year (on the jvm side at least) there will be no supervision strategies at all
Arsene Tochemey GANDOTE
@Tochemey
Oct 05 2016 08:51
@Horusiath so what is going to be used then? This is new to me.
@Horusiath On the Java side one can get the sender of the failing part. Except I am not reading well. http://doc.akka.io/docs/akka/2.4.4/java/fault-tolerance.html#fault-tolerance-java
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 08:54
I'm talking about long plans, where jvm akka api will probably change significantly - and from what I know, they're going to use function composition, something like (RestartOn<MyException>(actorBehavior))
Arsene Tochemey GANDOTE
@Tochemey
Oct 05 2016 08:55
OK
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 08:55
you can probably do the same on the .NET side
(I mean using sender)
John Nicholas
@MrTortoise
Oct 05 2016 09:10
@Horusiath lol. OK well I was looking at it simply as it seems to have nice deployment story. I was using fake to deploy to services prior... Was v heavy... Any azure suggestions? Maybe not azure? Just want opinions really
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 09:19
@MrTortoise most of the people having good service fabric experiences - the ones I've talked with - usually limited their use cases to what was shown in tutorials.
I've got a simple use case my self - I want to get list of available services with their endpoints, and if there is none, simply add a new one.
  • With consul this is trivial - you get list with services having ip and public ip or empty list.
  • With ASF you need to find which of the proposed data structure endpoints actually refers to the ip:port I'm interested with, and I need to cover whole logic with try/catch as if there is no active service, ASF will just throw an error.
Arsene Tochemey GANDOTE
@Tochemey
Oct 05 2016 09:22
@Horusiath Please how do I get the sender in the supervisory strategy?
John Nicholas
@MrTortoise
Oct 05 2016 09:23
@Horusiath ok cool. Will go do homework... Thanks
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 09:28
@Tochemey looks like you can't do it from anywhere, but you may override SupervisionStategy inside your actor, sender should be accessible from there
Arsene Tochemey GANDOTE
@Tochemey
Oct 05 2016 09:30
Cool
qwoz
@qwoz
Oct 05 2016 09:49
@Horusiath thanks for the info!
Wuttipat
@PlanCZero
Oct 05 2016 10:37
Hi everyone, I'm wondering how to set scheduler to stop and start actor. I'm using akka.net.
My scenario is I have 2 actors, first actor will transfer data from other database to mongodb, The second actor wil analyze data from mongodb to be report every mid night.
Before the second actor run, I want to stop the first actor and restart it again after the second actor finish.
Wuttipat
@PlanCZero
Oct 05 2016 10:42
Please advise, Thank you.
John Nicholas
@MrTortoise
Oct 05 2016 10:49
Why do you want to stop it?
Oh well build stop and start messages into your protocol. Don't actually stop and restart the actor.
So second would send please stop. When it receives have stopped then goes does its reporting. Then when finished sends start
Wuttipat
@PlanCZero
Oct 05 2016 10:54
I want to stop the first actor because I don't want new comming in when the secound analyzing data.
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 10:56
@PlanCZero you can send it a stop message ordering it to stop fetching messages from database
Wuttipat
@PlanCZero
Oct 05 2016 10:57
This message was deleted
Receive<string>(status => { if (status == "stop") { Context.Stop(Self); } });
Vagif Abilov
@object
Oct 05 2016 11:07
We are looking for a possibility to enrich log messages with correlationId in a structured manner, without inserting correlationId into a message text. Our logger is Serilog and usually it's simple to enrich logs with such data, Akka Serilog logger already uses this functionality and adds Timestamp, LogSource and Thread. But what if an application needs to add custom fields? I am sure this is quite common concern, how do people implement it with Akka without hard-coding extra fields right into a log string?
Bart Waterschoot
@bwaterschoot
Oct 05 2016 11:12
Can anyone shed some light as to how I can get the unhandled message warning on the following: https://gist.github.com/bwaterschoot/fcafc601941a9e55d7bf687ee97dc26a
Both states my actor can get in are able to receive the startprocessing message
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 11:26
@object enriching log message format is not so hard - you can pass message formater as a parameter to Context.GetLogger(). Usually more problematic part is how are you going to pass correlation id around ;)
@bwaterschoot personally I've never called Become(Stopped); from PreStart - you can simply initialize behavior by calling Stopped() in actor constructor - I don't know if this will help, but maybe it's worth trying
Bart Waterschoot
@bwaterschoot
Oct 05 2016 11:36
alright
I will give that a go
Vagif Abilov
@object
Oct 05 2016 11:36
Correlation Id is another story of course and we have special convention for how our message types look. But how can I pass the message formatter? I am looking at Serilog logger, it checks logMessage.Format. Should I set it there in each log operation?
And will it work from F#? We are loggin from F# code using methods defined in FsApi.fs. I see that log message there is expected to be string, not LogMessage.
Vagif Abilov
@object
Oct 05 2016 11:56
No it won't work with Akka F# logging function but it's no brainer to write replacement.
Bart Waterschoot
@bwaterschoot
Oct 05 2016 12:18
putting it in the ctor didn't fix it :|
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 12:23
@bwaterschoot are you sure that Supervisor_emailsender actor is of type Supervisor
Bart Waterschoot
@bwaterschoot
Oct 05 2016 12:24
yup
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 12:27
it looks like the problem is not in Supervisor actor, but in workers
this is where it fails, each worker is receiving StartProcessing message, which it couldn't handle
Bart Waterschoot
@bwaterschoot
Oct 05 2016 12:28
aha
based on the log message I just assumed it was the supervisor
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 12:29
Unhandled message from
;)
easy to miss
Damian Reeves
@DamianReeves
Oct 05 2016 14:44
Hey guys... is there a better/easier way for me to handle code like this?
    private IActorRef GetOrCreateBotUserActorRef(string userId)
    {
        var actorName = $"BotUser-{userId}";
        var actorRef = Context.Child(actorName);
        if (actorRef.IsNobody())
        {
            var props = BotUserActor.CreateProps(userId);
            actorRef = Context.ActorOf(props, actorName);
        }

        return actorRef;
    }
Peter Bergman
@peter-bannerflow
Oct 05 2016 14:54
Wanted to get some input on this, passing a Stopwatch in a message that is sent between two actors (in process)... would that be safe to do? I mean, if I start it, send it in a message then stop it in the other actor. Would that give an accurate reading of the time elapsed?
Arjen Smits
@Danthar
Oct 05 2016 16:35
Doable as long as its within a single actorsystem
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:07
I had a bit of a hard day trying to get the hang of how to do unit tests with Akka .NET. In typical unit testing, you have (say) a function, you call it with some inputs, and you expect a return value, against which you then run assertions. I'd like to do the same with Akka .NET, i.e. send a message to an actor (let's call it A), who will then send another message to another actor (let's call it B). I just want to test the output of the operation of handling that first message, i.e. that the message to B was sent, and perhaps that the message contains the right data. I tried various approaches, some involving TestKit, and some even attempting to use the actor as a normal class and call its methods (as with normal unit tests). I ran into a number of stumbling blocks (which I'll list next).
  1. You can't mock Tell() (e.g. using Moq) because it is an extension method.
  2. You can't mock Context because it is created internally.
  3. How do you use TestProbe with your handler relies on a consistent hashing router?
Peter Bergman
@peter-bannerflow
Oct 05 2016 18:08
@Danthar Ok, thanks
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:10
  1. You can't instantiate an actor (read: new it up) without an actor system. That kills most possibilities of unit testing without TestKit
  2. The Petabridge blog post suggests you can just do Sender.Tell(...) from within the actor's handler most of the time, and ExpectMsg(). This is unreasonable because (a) it's not true that this is the case 80% of the time (if you have a one-directional flow, then you won't have it at all), and (b) you can't expect people to add extra logic for the sake of tests.
  1. ExpectMsg checks what goes back to the sender, not what is sent ahead to other actors.
  2. I found an overload of ExpectMsg that takes an Action<message, IActorRef>. I tried it but it never actually got called. I haven't come across any documentation on how to use it
Arjen Smits
@Danthar
Oct 05 2016 18:11
@dandago2_twitter you can use the facilities of the testkit to get an reference to the underlying instance of an actor. This gives you direct access to public properties of your actor implementation. That could help in verifying state changes in one-directional messages flows.
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:12
So that's it, the numbering is messed up, but that's the list. I need to do a basic unit test as explained earlier, but Akka .NET seems to be designed without proper unit testing in mind (unless I'm missing something).
I can use TestKit (I've tried), but I couldn't find a way to check that outgoing Tell() as stated earlier @Danthar
if someone could enlighten me on how to do this basic step, I would be most grateful :)
Arjen Smits
@Danthar
Oct 05 2016 18:14
In the cases that i really want to do stuff like that. Its usually the case that the actorref which is the target of the Tell, is passed in the actorprops as an dependancy
so i can pass in the testprobe instead
and verify on that
if the target of your tell is an child actor
i test the childactor in isolation
but to test the integration between an actor and its child actors. So to verify that a "parent" actor, actually properly forwards stuff to its childs.
Besides testing for side effects, im not sure.
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:16
but sometimes I want to test logic which would be in the actor; unfortunately this is mixed up with the lines of Tell(), Context.Child(), and other similar stuff
it is really hard to extract this stuff separately
because sometimes you want to e.g. create a new child based on incoming data
Arjen Smits
@Danthar
Oct 05 2016 18:17
yes i get that
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:18
I looked into TestProbe, but (a) it is really ugly to work with, and (b) it doesn't cover all scenarios (e.g. what would you do about consistent hashing routers with underlying actors you can't mock?)
Arjen Smits
@Danthar
Oct 05 2016 18:18
if you do forwarding instead of tell, and the child replies back to sender, there are ways to test for that
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:18
I can't assume that :)
Just look at what it takes to do unit tests with Orleans: https://dotnet.github.io/orleans/Tutorials/Unit-Testing-Grains.html
why do we have to have a whole API in Akka .NET just to do this (and I haven't yet figured out how to do basic stuff with that API)?
I'm sorry if this sounds negative, I'm trying to understand whether I am missing something here
Arjen Smits
@Danthar
Oct 05 2016 18:23
Because in orleans they have a much higher abstracted implementation of the actor model
akka models communication with messages
orleans models it with method calls and does the messaging for you
the upside is, akka is more flexible and extensible and generally gives you more options.
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:24
yes, but if Akka .NET gives me a way to abstract things like Context and Tell(), as well as a way of creating an instance of my actor as a regular class (which is what I complained about in the list earlier), then I could just unit test the handlers
Arjen Smits
@Danthar
Oct 05 2016 18:25
You cannot create actors directly. Because the actor system handles the lifecycle of the actors for you. Orleans does that as well btw.
Its a keypoint for making actors work the way they do
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:25
I know, but for the sake of unit tests it would be okay to just treat it as a regular class
in a unit test (I mean a proper unit test, not an integration test) I don't care about the actor lifecycle, I just want to test the logic inside the actor
Arjen Smits
@Danthar
Oct 05 2016 18:26
No because then you would just be fooling yourself. Because you would treat it like a generic object, while in reality its not.
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:26
but that's exactly why we have this problem
Arjen Smits
@Danthar
Oct 05 2016 18:28
You test your actors 'interface' and their expected output.
You do that using messages because thats the only way you are allowed to communicate with your actors.
The testkit exists to make this tasks easier
But the reason why you cannot cheat your way around this way of communication
is because its an important way of how the actor model works.
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:30
I haven't managed to do a basic test with testkit, so I don't see how enforcing this approach helps
maybe I am missing something
Arjen Smits
@Danthar
Oct 05 2016 18:31
If you cannot write a unit test for a single actor, that actually tests what you want to test for that particular actor
then what that tells me, is that the design of that actor probably has some issues
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:31
sorry, are you for real?
is there a design issue with the simple scenario I mentioned?
Arjen Smits
@Danthar
Oct 05 2016 18:32
That wasn't meant as a personal attack or anything. Its just an observation.
The parent child thing ?
no
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:32
all I want is someone to let me know how to test the scenario where my actor sends a message elsewhere :)
Arjen Smits
@Danthar
Oct 05 2016 18:33
I have been looking around during this talk. But have not found a definitive answer for that yet.
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:33
I have tried a few things myself, as mentioned earlier... not sure how best to approach this
Marc Piechura
@marcpiechura
Oct 05 2016 18:33
If you want to check if a parent creates a child you can send a identity message to the path and see if you get nobody back or not
Maybe it's easier to help with a real code example
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:34
my test scenario does not have parent/child relationships :)
it is just a simple Tell()
Arjen Smits
@Danthar
Oct 05 2016 18:34
@dandago2_twitter so the actor your sending the message to, is not a child actor ?
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:35
no
Arjen Smits
@Danthar
Oct 05 2016 18:35
because thats what iv'e understood sofar
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:35
ok, let me explain again :)
Arjen Smits
@Danthar
Oct 05 2016 18:35
But isn't it easy then ?
How does your actor get a reference to the actor its sending a message to ?
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:35
let's say you pass it in the constructor, so it's mockable
Arjen Smits
@Danthar
Oct 05 2016 18:36
ok
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:36
Tell(messageX) -> ActorA; then ActorA::Handle(messageX) does Tell(messageY) -> ActorB
Arjen Smits
@Danthar
Oct 05 2016 18:36
if you pass it in the constructor
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:36
when I do Tell(messageY) -> ActorB, how do I check that (a) it was sent, and (b) it includes what I'm expecting?
that's the scenario
Arjen Smits
@Danthar
Oct 05 2016 18:37
then pass in a reference to the testprobe, and use its interface to verify that a message has been received
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 18:37
@Danthar you forgot about ActorOfAsTestSomething method
Arjen Smits
@Danthar
Oct 05 2016 18:37
gimme a sec to type an example
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 18:38
I can't remember the exact name of the method
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:38
@Horusiath I tried using that, how does it help exactly?
I still can't call the underlying handler
at least if I conform to TestKit's expectations
Arjen Smits
@Danthar
Oct 05 2016 18:38
@Horusiath ActorOfAsTestActorRef
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 18:39
@dandago2_twitter it replaces default mailbox with test one allowing you to call certain assertions
Arjen Smits
@Danthar
Oct 05 2016 18:39
@dandago2_twitter check this post: https://petabridge.com/blog/how-to-unit-test-akkadotnet-actors-akka-testkit/ and go to the section The TestProbe
@Aaronontheweb that post could use anchor tags ;)
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 18:41
if I'm right, I don't see why asserting if direct message sent to an actor was actually sent is going to help with anything
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:41
@Danthar I hate that post, it's the one making all the assumptions about you needing to only do a Sender.Tell() to write 80% of your unit tests :)
so using TestProbe I'd essentially have to write the equivalent of an untyped actor, handling all the expected messages
@Horusiath say you have some logic in a handler; depending on the incoming message, it sends out a different message. Wouldn't you want to verify that the right message is being sent out?
is there an example of the assert-on-mailbox thing you mention?
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 18:43
checkout what message it send out, not if it received incoming message
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:43
that's what I want :)
I want to assert on the output, not the input
Marc Piechura
@marcpiechura
Oct 05 2016 18:43
        [Fact]
        public void A()
        {
            var a = ActorOf(Props.Create(() => new A(TestActor)));
            a.Tell("a");
            ExpectMsg("a + b");
        }

        class A : ReceiveActor
        {
            public A(IActorRef b)
            {
                Receive<string>(s => b.Tell(s + " + b"));
            }
        }
thats it ;)
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:43
ExpectMsg works only if you're sending something back to the sender
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 18:43
output needs a receiver, just probe the receiver and make necessary assertion
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:44
so you say testprobe is the way to go for this?
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 18:44
just like @Silv3rcircl3 showed, he's using TestActor instead of probe
Marc Piechura
@marcpiechura
Oct 05 2016 18:45
        [Fact]
        public void A_()
        {
            var a = ActorOfAsTestActorRef<A>();
            a.Tell("a");
            a.UnderlyingActor.Received.ShouldBe("a");
        }

        class A : ReceiveActor
        {
            public string Received { get; set; }

            public A()
            {
                Receive<string>(s => Received =s);
            }
        }
then this way
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:46
oh, I think that's exactly what I've been looking for
Arjen Smits
@Danthar
Oct 05 2016 18:46
Sometimes code samples speak a thousend words
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 18:46
@Silv3rcircl3 are you sure, UnderlyingActor is public?
Marc Piechura
@marcpiechura
Oct 05 2016 18:46
yup
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:46
yeah, having this in the documentation could have saved me a day of work
and yeah UnderlyingActor is public, used it this morning
Marc Piechura
@marcpiechura
Oct 05 2016 18:47
blob
;-)
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:47
just another thing, how do you do the same thing when dealing with routers?
e.g. handler sends a message to a consistent hashing router; you want to ensure it was sent right (same thing)
Marc Piechura
@marcpiechura
Oct 05 2016 18:48
you mean if you would create a router with multiple A's ?
you don't test the logic of the router, we do that for you ;)
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:48
that's not what I mean :)
so, we have Actor A again
Actor A at some point creates a consistent hashing router
when it receives a message, it sends a message (based on whatever logic) to the router
required: to ensure that that message got sent out right
Marc Piechura
@marcpiechura
Oct 05 2016 18:49
router is a child of the A?
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:49
yeah I think we can make that assumption here
Marc Piechura
@marcpiechura
Oct 05 2016 18:50
and what happens then? where do the messages go from the routees of the router? maybe we call them b ;)
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:50
we don't care :) we just want to make sure A has sent the message
Marc Piechura
@marcpiechura
Oct 05 2016 18:51
then why test it anyway ? ^^
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:51
hmmm
haha actually you're right, it becomes just another Tell() test
not sure what the problem was this morning then, I'll refresh my memory when I see the code again
thanks guys for your time :)
Marc Piechura
@marcpiechura
Oct 05 2016 18:51
np
Arjen Smits
@Danthar
Oct 05 2016 18:51
np
Daniel D'Agostino
@dandago2_twitter
Oct 05 2016 18:51
much appreciated
Damian Reeves
@DamianReeves
Oct 05 2016 20:19
Are there any recommendations or a roadmap concerning Akka.Persistence.SqlServer and SQL Server 2016's JSON type. The current column is VARBINARY which would seem to exlude us from getting any of the benefits of the JSON type. You could of course use the Manifest field it seems for potentially indexable JSON data.
Bartosz Sypytkowski
@Horusiath
Oct 05 2016 21:27
@DamianReeves postgres plugin has json/jsonb support (I don't know if it's released already) - we probably could add it to sql server too, but as it will break binary compatibility, it probably won't happen before v1.5
Andrey Leskov
@andreyleskov
Oct 05 2016 21:56
@DamianReeves you can store data as json string serialized in Unicode format with custom serializer. After json can be retrievied by sql CAST \ CONVERT
I'm using this approach now, just created view for Journal table
Damian Reeves
@DamianReeves
Oct 05 2016 21:58
Guess I can give that a shot
Really want to do things like index Correlation and MessageIds so wondering if Manifest is another viable option
Andrey Leskov
@andreyleskov
Oct 05 2016 22:03
Manifest is used to store only Type information, serializers will try to get a type from it. I did not find any possibility to embend custom information into Manifest
Damian Reeves
@DamianReeves
Oct 05 2016 22:04
oh ok. I forgot about that
in my mind I kept reading Manifest as Metadata
Andrey Leskov
@andreyleskov
Oct 05 2016 22:06
Yes, had same feeling ) May be tags column will fit ?
Damian Reeves
@DamianReeves
Oct 05 2016 22:07
Have you actually indexed the columns in your view? is it schemabound?
Andrey Leskov
@andreyleskov
Oct 05 2016 22:08
No, I prefer to keep original indexes and using view only for diagnostics \ debug in production. May be will pass json events to BI in future.
Damian Reeves
@DamianReeves
Oct 05 2016 22:09
Ok, I see
Andrey Leskov
@andreyleskov
Oct 05 2016 22:15
are you interested in passing events from journal to Projection ?
https://github.com/evendotnet/Even#projections
Damian Reeves
@DamianReeves
Oct 05 2016 22:20
funny... I'm a contributor to that project
I was starting to be afraid Even is solving a problem that streams and persistence query solves, but in practice I see it solves an actual need
Andrey Leskov
@andreyleskov
Oct 05 2016 22:25
From my point of view right now akka persistent journals really need possibility to subscribe to all persisted events as stream : akkadotnet/akka.net#2321
it will help a lot
Damian Reeves
@DamianReeves
Oct 05 2016 22:30
Yeah I'm really interested in the projection story of persistent journals... Even gives us this but its not mature, I'm starting to wonder if we just need to add Reactive Streams support to even, but honestly though I get Rx I haven't quite grokked Reactive Streams yet
I think this convo is inspiring me to do a spike on Even (that and I've found myself re-implementing functionality I know Even has in an Akka based CQRS service we are building)
Andrey Leskov
@andreyleskov
Oct 05 2016 22:35
I'm using simplified approach for projection - just pub\sub via EventBus \ DistributedPubSub and will gladly look at more convinient approaches