Skip to content

Instantly share code, notes, and snippets.

View phatboyg's full-sized avatar

Chris Patterson phatboyg

View GitHub Profile
@phatboyg
phatboyg / First.cs
Created July 6, 2012 18:46
SignalR MT Integration Post
public class Location :
Hub
{
public Task GetLocation(string truckId)
{
Task task = null;
Bus.Instance.PublishRequestAsync(new GetLocation { TruckId = truckId }, x =>
{
task = x.Handle(message => {});
x.SetTimeout(30.Seconds());
@phatboyg
phatboyg / DoublePumped_Specs.cs
Created April 18, 2012 03:41
Not the greatest way to put two state machines on the same state
// Copyright 2011 Chris Patterson, Dru Sellers
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
@phatboyg
phatboyg / notes.txt
Created April 13, 2012 15:27
Git Usage
git fetch origin
git checkout develop
git rebase origin/develop
-- this pulls any commits from the server (origin) to my local repository
-- checks out (switches to...) my local develop branch
-- aligns my develop branch to the origin/develop branch (cleans up history)
If I had an existin feature branch...
@phatboyg
phatboyg / mac.gitconfig
Created April 13, 2012 14:08
Git Configuration
[user]
name = Chris Patterson
email = chris@phatboyg.com
[core]
autocrlf = false
[alias]
ci = commit
undo = reset --hard
up = pull origin master
@phatboyg
phatboyg / MyExample.java
Created March 27, 2012 03:20
Using Java Executors for scheduling timeouts on operations
import java.util.concurrent.*;
class MyCallable implements Callable<Integer>
{
int limit;
public MyCallable(int limit)
{
this.limit = limit;
}
@phatboyg
phatboyg / Program.cs
Created February 23, 2012 22:45
Working Both Handler and Consumer
namespace ConsoleApplication12
{
using System;
using MassTransit;
class Program
{
static void Main(string[] args)
{
Bus.Initialize(sbc =>
@phatboyg
phatboyg / ActorBehaviorExample.cs
Created November 28, 2011 22:59
Example of applying behavior to an actor
class Cleaner_version_of_defining_actor_behavior
{
public void Some_method_in_your_code()
{
// create the actor instance, passing the state and an initializer
// in this case, applying the initial behavior of to the actor
ActorRef agent = Actor.New<MyState>(x => x.Apply<DefaultBehavior>());
// now messages can be sent to the actor to make it do things
// we will use a stateless actor for that interaction
@phatboyg
phatboyg / MyActor.cs
Created July 27, 2011 13:49
How to stage build actors in an actor chain/network
public class MyActor :
Actor
{
public MyActor(Inbox inbox)
{
inbox.Receive<InitMyActor>(initMsg =>
{
var myActorScopeValue = initMsg.Scope;
inbox.Loop(loop =>
@phatboyg
phatboyg / SagaTrace.txt
Created June 29, 2011 19:00
Output from Trace
-------------------------------------------------------------------------------------------------------------------------------------------
Trace URI: msmq://localhost/mt_subscriptions 15 messages
-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Received: c940f977-ff3f-4195-99a5-9f110121ddd9 2011-06-29 05:35:20.614
---------------------------------------------------------------------------------------------------------------------------------------
Message Id: ad32c234-567b-4691-9f2f-314e31498c8a\1067975
Source Address: msmq://localhost/mt_subscriptions?tx=false
Input Address: msmq:
@phatboyg
phatboyg / MassTransitConsumer.cs
Created June 29, 2011 01:48 — forked from jrutley/Ping.cs
MassTransit 2.0 beta questions (updated to allow run from different machines)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MassTransit;
using MassTransitExperimentShared;
using System.Threading;
namespace MassTransitConsumer
{