Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Danthar's full-sized avatar

Arjen Smits Danthar

  • The Netherlands
View GitHub Profile
[TestFixture()]
public class ChangeModeTests : RavenTestDriver
{
public ChangeModeTests()
{
ConfigureServer(new TestServerOptions()
{
});
}
@Danthar
Danthar / ParralelProcessingStream.cs
Last active July 21, 2021 13:18
Unlimited Parrallel processing flows example
/// a=>process1 =>ack
/// / \
/// / \
/// a=>(a)=>BROADCAST - a=>process2 =>ack ZIP=>transform(a, completionSignal)
/// \ /
/// \ /
/// a=>process3 => ack
public static Flow<I, O, NotUsed> ParralelProcessingStream<I, O>(params Flow<I, O, NotUsed>[] processingFlows)
{
return Flow.FromGraph(GraphDsl.Create(builder =>
@Danthar
Danthar / gist:94054550f42f287a3a0be78f142526bf
Last active July 20, 2021 14:02
c# PassThroughFlow example Akka.Streams
/// <summary>
/// As translated from: https://doc.akka.io/docs/alpakka/current/patterns.html#passthrough
/// </summary>
public class PassThroughFlow
{
public static IGraph<FlowShape<A, (T,A)>, NotUsed> create<A,T>(Flow<A, T, NotUsed> flow) {
return create(flow, Keep.Both);
}
[Test]
public void Can_Serialize_ICommandResult_With_Sql_Exception()
{
SqlException exception;
try
{
throw SqlExceptionCreator.NewSqlException(101);
} catch(SqlException ex)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);PackReferencedProjectOutputs</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
// we put this target in an props file and import it
<Target Name="PackReferencedProjectOutputs" DependsOnTargets="BuildOnlySettings;ResolveReferences">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);PackReferencedProjectOutputs</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
// we put this target in an props file and import it
<Target Name="PackReferencedProjectOutputs" DependsOnTargets="BuildOnlySettings;ResolveReferences">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
@Danthar
Danthar / gist:30ee6133294e3f1a85dcd5bc948fc625
Last active August 31, 2017 13:53
EventAdapters Persistence review based on changes
Premise:
We need an extra manifest column for EventAdapters. Because SerializerWithStringManifest type serializers are not compatible.
Findings:
EventAdapters are registered via an ActorSystem extension. And they are utilised based on an type -> adapter mapper. Which means if you want to utilise them you have to provide a mapping for the message type you want to use it on. Same concept as how serialization-bindings work.
EventAdapters are layered in the persistence system. Like a layer of a sandwich :P.
@Danthar
Danthar / cluster config TraderActor SM host
Created May 26, 2017 10:16
Akka.net cluster singleton example
cluster {
seed-nodes = ["akka.tcp://TradingRoomActors@localhost:8083"]
roles = ["traderworker"]
singleton {
singleton-name = "TraderActor"
role = "traderworker"
hand-over-retry-interval = 1s
}
singleton-proxy {
singleton-name = "TradesActor"
public static class SerializerTestHelpers
{
public static async Task<T> AkkaSerialized<T>(this T src)
{
var hocon = "akka.actor.provider = \"Akka.Remote.RemoteActorRefProvider, Akka.Remote\"" +
Environment.NewLine +
"akka.remote.helios.tcp.port = 0" + Environment.NewLine +
"akka.remote.helios.tcp.hostname = localhost";
var sys = ActorSystem.Create("src");//, ConfigurationFactory.ParseString(hokon));
await sys.Terminate();
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="akka" type="Akka.Configuration.Hocon.AkkaConfigurationSection, Akka"/>
</configSections>
<akka>
<hocon>
akka {
stdout-loglevel = DEBUG