Skip to content

Instantly share code, notes, and snippets.

View HowardvanRooijen's full-sized avatar

Howard van Rooijen HowardvanRooijen

View GitHub Profile
@HowardvanRooijen
HowardvanRooijen / RetryUntilLeaseAcquiredPolicy.cs
Last active August 29, 2015 14:16
RetryUntilLeaseAcquiredPolicy extension for Endjin.Retry
#region Using Directives
using System;
using Endjin.Core.Retry.Policies;
#endregion
public class RetryUntilLeaseAcquiredPolicy : IRetryPolicy
{
@HowardvanRooijen
HowardvanRooijen / DoNotRetryOn304NotModified.cs
Created March 3, 2015 08:01
DoNotRetryOn304NotModified extension for Endjin.Retry
#region Using Directives
using System;
using System.Net;
using Endjin.Core.Retry.Policies;
using Microsoft.WindowsAzure.Storage;
#endregion
@HowardvanRooijen
HowardvanRooijen / StorageWriteExceptionRetryPolicy.cs
Created March 3, 2015 08:02
StorageWriteExceptionRetryPolicy extension for Endjin.Retry
#region Using Directives
using System;
using System.Diagnostics;
using System.Net;
using Endjin.Core.Retry.Policies;
using Endjin.Kpi.Core.Extensions;
using Microsoft.WindowsAzure.Storage;
@HowardvanRooijen
HowardvanRooijen / HttpRequestExceptionRetryPolicy.cs
Created March 3, 2015 08:03
HttpRequestExceptionRetryPolicy extension for Endjin.Retry
#region Using Directives
using System;
using System.Net.Http;
using Endjin.Core.Retry.Policies;
#endregion
public class HttpRequestExceptionRetryPolicy : IRetryPolicy
Scenario: Actor A attempts to execute a long running task whilst Actor B is currently running the task
Given the long running task takes 20 seconds to complete
And the lease name is "long-running-task"
And actor B is currently running the task
When Actor A executes the task
Then it should not throw any exceptions
And it should return successfully
And 2 actions should have completed successfully
@HowardvanRooijen
HowardvanRooijen / Server.js
Created March 7, 2015 10:32
HTTP Proxy Node Service for forwarding data into Azure Event Hubs HTTPS endpoint from a low power HTTP device
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var https = require('https');
function HttpPostToAzure(jsonData)
{
// Build the HTTP Post
// Currently using hardcoded auth string, this auth string could come via the device
var post_options =
@HowardvanRooijen
HowardvanRooijen / Web.config
Created March 7, 2015 10:34
Web.Config for the Node HTTP Proxy for Azure Event Hubs
<?xml version="1.0" encoding="utf-8"?>
<!--
This configuration file is required if iisnode is used to run node processes behind
IIS or IIS Express. For more information, visit:
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->
<configuration>
<system.webServer>
@HowardvanRooijen
HowardvanRooijen / IISNode.yml
Created March 7, 2015 10:35
IISNode configuration for HTTP Proxy for Event Hubs
loggingEnabled: true
devErrorsEnabled: true
@HowardvanRooijen
HowardvanRooijen / NuGet.config
Created March 31, 2015 06:45
Custom NuGet Configuration file for performing a package restore against a private nuget feed. Useful for Azure Web Apps
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="custom_package_source" value="https://custom_package_source/nuget/v1/FeedService.svc/" />
</packageSources>
<disabledPackageSources />
<packageSourceCredentials>
<custom_package_source>
@HowardvanRooijen
HowardvanRooijen / gist:d5b50fc920809f1f9467
Created April 15, 2015 08:21
Azure Storage Emulator Hook for SpecFlow
@container @storage_emulator
Scenario: A long running task runs to completion
Given the long running task takes 3 seconds to complete
And the task is told to cancel if the cancellation token '19d411fc-5014-4eaa-8f84-0fe3d4b93068' is issued
And no cancelation token is issued
When I execute the task
Then it should complete sucessfully