This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Akka.Actor; | |
namespace AkkaTrackerManager | |
{ | |
class Program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Configuration; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using System.Security.Cryptography; | |
using System.Text; | |
using System.Threading.Tasks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine: | |
environment: | |
PATH: "$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH" | |
MIX_ENV: "ci" | |
services: | |
- postgresql | |
database: | |
override: | |
- createdb adatabasename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deployment: | |
staging: | |
branch: master | |
heroku: | |
appname: frozen-sauce-31481 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task InitAsync(IProvider provider, IContext context) | |
{ | |
// other bits removed for brevity | |
await State.GetEventsAsync(Name, Index, callbackData => | |
{ | |
// dont wrap callbackData in anything (callbackData could be renamed to @event?) | |
Context.ReceiveAsync(callbackData).Wait(); | |
Index++; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task ReceiveAsync(IContext context) | |
{ | |
switch (context.Message) | |
{ | |
//...other handlers removed for brevity | |
case Multiply msg: | |
await Persistence.PersistEventAsync(new Multiplied { Amount = msg.Amount }); | |
break; | |
case Multiplied msg: | |
_state.Value = _state.Value * msg.Amount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public async void RoundRobinGroupRouter_RouteesCanBeRemoved() | |
{ | |
var routee1 = Actor.Spawn(MyActorProps); | |
var routee2 = Actor.Spawn(MyActorProps); | |
var routee3 = Actor.Spawn(MyActorProps); | |
var routerProps = Router.NewRoundRobinGroup(Actor.FromProducer(() => new MyTestActor()) | |
.WithMailbox(() => new TestMailbox()), routee1, routee2, routee3) | |
.WithMailbox(() => new TestMailbox()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public async void RoundRobinGroupRouter_RouteesCanBeRemoved() | |
{ | |
var routee1 = Actor.Spawn(MyActorProps); | |
var routee2 = Actor.Spawn(MyActorProps); | |
var routee3 = Actor.Spawn(MyActorProps); | |
var props = Router.NewRoundRobinGroup(MyActorProps, routee1, routee2, routee3) | |
.WithMailbox(() => new TestMailbox()); | |
var router = Actor.Spawn(props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void WhenActorStopped_MessagesGoToDeadLetter() | |
{ | |
bool deadLetterEventReceived = false; | |
var eventStream = new EventStream(); | |
eventStream.Subscribe<DeadLetterEvent>(@event => deadLetterEventReceived = true); | |
var props = Actor.FromProducer(() => new DoNothingActor()) | |
.WithMailbox(() => new TestMailbox()) | |
.WithEventStream(eventStream); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Collection("EventStream Tests")] | |
public class DeadLetterTests | |
{ | |
[Fact] | |
public void WhenActorStopped_MessagesGoToDeadLetter() | |
{ | |
bool deadLetterEventReceived = false; | |
EventStream.Instance.Subscribe<DeadLetterEvent>(@event => deadLetterEventReceived = true); | |
var props = Actor.FromProducer(() => new DoNothingActor()) |
OlderNewer