Skip to content

Instantly share code, notes, and snippets.

View rogeralsing's full-sized avatar
😈
Feeling Awesome

Roger Johansson rogeralsing

😈
Feeling Awesome
View GitHub Profile
open Akka.FSharp
open Akka
open Akka.Configuration
let system = System.create "my-system" (Configuration.defaultConfig())
let aref =
spawn system "my-actor"
(fun mailbox ->
let rec loop(state) = actor {
Domain
ref till Squeed.Infrastructure
innehåller repos, entiteter, value objects etc
Känner bara till IUoW
Context
ref till domän och EF
open Akka.FSharp
open Akka
open Akka.Configuration
let system = System.create "my-system" (Configuration.defaultConfig())
let aref =
spawn system "my-actor"
(fun mailbox ->
let rec loop(state) = actor {
@rogeralsing
rogeralsing / ActorAsyncAwaitSpec.cs
Last active August 29, 2015 14:15
Safe Async Await in Actors
using System;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.TestKit;
using Xunit;
namespace Akka.Tests.Dispatch
{
public class AsyncAwaitActor : ReceiveActor
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
namespace NaiveThreadPool
{
class Program
{
@rogeralsing
rogeralsing / gist:b3a2a0cc689ccfbf12d6
Last active August 29, 2015 14:18
Akka.NET differences

Actor Plugins

Plugins let you register handlers that help initialize an actor upon start up. We are currently using this for the Stashing support.

Instead of providing AbstractUntypedStashedActor, AbstractTypedStashedActor, AbstractYaddaYaddaStashedActor etc. (F# versions etc) We can instead apply an interface to the actor type, and let the framework inject extra state holders and such. it's sort of a poor mans Mixins

Dependency Injection

@rogeralsing
rogeralsing / gist:d05e4b7cc64a3cfff3b8
Last active March 4, 2018 11:44
Durable Messagebus integration with Akka and Azure Servicebus
using System;
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Routing;
using Microsoft.ServiceBus.Messaging;
namespace ConsoleApplication13
{
public class MyBusinessActor : ReceiveActor
@rogeralsing
rogeralsing / gist:2744ce7b83a822080a3a
Created July 9, 2015 08:50
update all nodes with roslyn?
//other junk
....
....
Dictionary<StatementSyntax,StatementSyntax> lookup = new Dictionary<StatementSyntax,StatementSyntax>();
if (returnActions.Count > 0)
{
foreach(var ifStatement in returnActions)
{
var mainCall = ifStatement.GetPrevious() as ExpressionStatementSyntax;
var newIfStatement = ifStatement.WithCondition(mainCall.Expression.WithoutTrivia());
var references = await SymbolFinder.FindReferencesAsync(semanticClass, document.Project.Solution);
var referenceCount = (from reference in references
from locaton in reference.Locations
select locaton).Count();
import akka.actor._
import com.typesafe.config.ConfigFactory
object Program {
def main(args:Array[String]): Unit ={
val conf = ConfigFactory.load(ConfigFactory.parseString("""
akka{
stdout-loglevel = WARN
loglevel = WARN
log-config-on-start = off