Skip to content

Instantly share code, notes, and snippets.

View andreasohlund's full-sized avatar

Andreas Öhlund andreasohlund

View GitHub Profile
public class EndpointConfig : AsA_Server, IConfigureThisEndpoint,IWantCustomInitialization
{
public void Init()
{
Configure.With()
.Log4Net()
.UsingContainer<SpringObjectBuilder>()
}
public class SSSBMessageForwarder : IWantToRunAtStartup
{
readonly IBus _bus;
readonly ITransport _transport;
public SSSBMessageForwarder(IBus bus, ISSSBTransportFactory transportFactory)
{
_bus = bus;
_transport = transportFactory.GetTransport();
CREATE PROCEDURE [dbo].[SendNServiceBusMessage]
@TargetService NVARCHAR(200),
@MessageName NVARCHAR(200),
@MessageContent NVARCHAR(4000)
AS
BEGIN
-- Sending a Service Broker Message
DECLARE @InitDlgHandle UNIQUEIDENTIFIER;
using NServiceBus.ObjectBuilder.Common.Config;
using NServiceBus.ObjectBuilder.Spring;
using Spring.Context.Support;
using NServiceBus;
namespace CoreOnly
{
class Program
{
static void Main(string[] args)
using System;
using System.Linq.Expressions;
using NServiceBus;
using Rhino.Mocks;
using Rhino.Mocks.Interfaces;
using NSB = NServiceBus;
namespace NullReference.NServiceBus
{
public static class BusTestExtensions
public class NHibernateMessageHandler:IHandleMessages<NHibernateMessage>
{
readonly ISession session;
public NHibernateMessageHandler(ISession session)
{
this.session = session;
}
public void Handle(NHibernateMessage message)
var container = new Container(x =>
{
x.ForSingletonOf<ISessionFactory>().Use(ConfigureSessionFactory());
x.For<ISession>().Use(ctx => ctx.GetInstance<ISessionFactory>().OpenSession());
});
@andreasohlund
andreasohlund / gist:668297
Created November 8, 2010 21:23
SSSBMessageForwarder
public class Forwarder: IWantToRunAtStartup
{
readonly IBus _bus;
readonly ITransport _transport;
public Forwarder(IBus bus, IYourOwnTransportFactory transportFactory)
{
_bus = bus;
_transport = transportFactory.GetTransport();
public class MySSSBTransportFactory : ISSBTransportFactory
{
readonly string _connectionString;
readonly IMessageSerializer _messageSerializer;
public TaxberTransportFactory(string connectionString, IMessageSerializer messageSerializer)
{
_connectionString = connectionString;
_messageSerializer = messageSerializer;
}
/// <summary>
/// The main interface for interactions with the databus
/// </summary>
public interface IDataBus
{
/// <summary>
/// Gets a data item from the bus
/// </summary>
/// <param name="key"></param>
/// <returns></returns>