This file contains hidden or 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
#Modified and simplified version of https://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/ | |
$subscription = "[Your Subscription Name]" | |
$service = "[Your Azure Service Name]" | |
$slot = "staging" #staging or production | |
$package = "[ProjectName]\bin\[BuildConfigName]\app.publish\[ProjectName].cspkg" | |
$configuration = "[ProjectName]\bin\[BuildConfigName]\app.publish\ServiceConfiguration.Cloud.cscfg" | |
$timeStampFormat = "g" | |
$deploymentLabel = "ContinuousDeploy to $service v%build.number%" | |
Write-Output "Running Azure Imports" |
This file contains hidden or 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 abstract class AggregateRoot : IAggregateRoot | |
{ | |
private const int DefaultVersion = 0; | |
private readonly Dictionary<Type, Action<IEvent>> handlers = new Dictionary<Type, Action<IEvent>>(); | |
private List<IEvent> _uncommitedChanges = new List<IEvent>(); | |
public Guid Id { get; protected set; } | |
public int Version { get; private set; } |
This file contains hidden or 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 Newtonsoft.Json; | |
using System; | |
using System.Collections.Specialized; | |
using System.Net; | |
using System.Text; | |
//A simple C# class to post messages to a Slack channel | |
//Note: This class uses the Newtonsoft Json.NET serializer available via NuGet | |
public class SlackClient | |
{ |
This file contains hidden or 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
type Stream = string | |
type EventType = string | |
type ExpectedVersion = int | |
type EventData = byte[] | |
type EventMetadata = byte[] | |
type ResolveLinks = bool | |
type From = int | |
type BatchSize = int | |
type BufferSize = int | |
type CheckpointStore = (unit -> Async<int option>) * (int -> Async<unit>) |
This file contains hidden or 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
/// Code to bind mailbox processors to azure storage queues. | |
module AzureMailboxProcessor | |
open System | |
module private Async = | |
let AwaitTaskEmpty = Async.AwaitIAsyncResult >> Async.Ignore | |
module private Option = | |
let fromNullable (nullable:Nullable<_>) = if nullable.HasValue then Some nullable.Value else None | |
let toNullable = function |
This file contains hidden or 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
// Our simple domain model | |
type Priority = | |
| Low | |
| Normal | |
| High | |
type Message = { | |
Text : string | |
Priority : Priority | |
} |
This file contains hidden or 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
// A connection to a Azure Service Bus-backed CloudAgent actor pool | |
let cloudConnection = CloudConnection.ActorCloudConnection(ServiceBusConnection "Endpoint=sb://myservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=fsdoifsm0983m29048098dfs", Connections.Queue "myqueue") | |
(* Posting messages - run this code on every producer *) | |
let sendTo = ConnectionFactory.SendToActorPool CloudConnection | |
let sendToIsaac = sendTo (ActorKey "isaac") | |
sendToIsaac Clear |> Async.RunSynchronously // send a message to Clear the file to the Isaac actor | |
sendToIsaac(Record { Text = "Hello"; Priority = Priority.Low }) |> Async.RunSynchronously // Send a new message to Isaac | |
(* Consuming messages - run this code on every consumer *) |
This file contains hidden or 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
let CreateActor (ActorKey name) = | |
MailboxProcessor.Start(fun mailbox -> | |
let messageStore = GetMessageStore name | |
let rec loop data = | |
async { | |
// Wait asynchronously until we get a message + reply channel | |
let! message, replyWith = mailbox.Receive() | |
match message with | |
| Clear -> |
This file contains hidden or 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
#time "on" | |
#load "Bootstrap.fsx" | |
open System | |
open Akka.Actor | |
open Akka.Configuration | |
open Akka.FSharp | |
open Akka.TestKit | |
// #Using Actor |
This file contains hidden or 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 static class PipingExtensions | |
{ | |
/// <summary> | |
/// Take an object, pipe it into a function, and return the result. | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <typeparam name="T2"></typeparam> | |
/// <param name="obj"></param> | |
/// <param name="f"></param> | |
/// <returns></returns> |
OlderNewer