Skip to content

Instantly share code, notes, and snippets.

💻
Working

Jeff Hollan jeffhollan

💻
Working
Block or report user

Report or block jeffhollan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View loader.io.json
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"loaderio": {
"matchCondition": {
"methods": [ "GET" ],
"route": "/loaderio125125125"
},
"responseOverrides": {
"response.body": "loaderio125125125",
View my.csproj
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)SupportedMediaTypes.json&quot; &quot;$(TargetDir)bin/SupportedMediaTypes.json&quot;" />
</Target>
View contextfactory.cs
public class BloggingContextFactory : IDesignTimeDbContextFactory<BloggingContext>
{
public BloggingContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<BloggingContext>();
optionsBuilder.UseSqlServer(Environment.GetEnvironmentVariable("SqlConnectionString"));
return new BloggingContext(optionsBuilder.Options);
}
}
View ef-startup.cs
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
[assembly: FunctionsStartup(typeof(functions_csharp_entityframeworkcore.Startup))]
namespace functions_csharp_entityframeworkcore
{
class Startup : FunctionsStartup
View functionef.cs
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace functions_csharp_entityframeworkcore
{
public class HttpTrigger
View dbcontext.cs
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
namespace functions_csharp_entityframeworkcore
{
public class BloggingContext : DbContext
{
public BloggingContext(DbContextOptions<BloggingContext> options)
@jeffhollan
jeffhollan / topicRetry.md
Last active Apr 9, 2019
Topic exponential retry
View topicRetry.md

What about topics?

Topics are tricky because it's a pub/sub model. If you publish one message to the topic, all subscribers receive a copy of that message. Let's say I have a topic with 10 subscribers. Subscriber 1-9 process the message just fine. Subscriber 10 gets its message, but hits an exception. If you followed this code above for the topic, the message would be scheduled back onto the topic. However, that means not only would subscriber 10 get the retry, but subscribers 1-9 would get a copy of the retry too.

My recommendation is that for topics where you want to enable exponential retries, use the forwarding feature of Azure Service Bus. The forwarding feature allows you to forward all messages to a queue or topic subscription to another queue or topic. In the case above I created a queue in my namespace for subscriber 10. I then ran the following CLI command to forward all messages to subscriber 10s subscription to that new queue. Now I have my function fire and exponentially retry on t

@jeffhollan
jeffhollan / GameSessionActor.cs
Last active Apr 9, 2019
Tic Tac Toe durable sample
View GameSessionActor.cs
using System;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
namespace DurableFunctionsAlpha.TicTacToe
{
public static class GameSessionActor
{
[FunctionName("GameSessionActor")]
public static async Task RunGame(
@jeffhollan
jeffhollan / GitHubWebookFunction.cs
Last active Apr 7, 2019
Brainstorming around how actor interface could be exposed for csharp
View GitHubWebookFunction.cs
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using DurableFunctionsAlpha.BlueSky;
namespace DurableFunctionsAlpha
{
View ignite-autohotkey.h
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
;SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetKeyDelay, 10
^+1::
Send, ["value"]
Return
You can’t perform that action at this time.