public NServiceBusMessageHandler(IBusHandlerProvider busHandlerProvider, IBus bus) : base( busHandlerProvider, bus, nbusMessage => nbusMessage, message => message) { }
public NServiceBusEventHandler(IBusHandlerProvider busHandlerProvider, IBus bus) : base( busHandlerProvider, bus, nbusMessage => new BusMessage { TopicName = nbusMessage.TopicName, Payload = nbusMessage.Payload }, message => new BusEvent { TopicName = message.TopicName, Payload = message.Payload }) { }
/// <summary> /// Creates generic NServiceBus handler with capability to transform generic message to concrete one and back so we keep independence /// from NService bus /// </summary> /// <param name="busHandlerProvider">Message handler provider</param> /// <param name="bus">Generic Bus</param> /// <param name="nServiceBusToMessageFunc">Conversion function from NServiceBus type to generic message</param> /// <param name="messageToNServiceBusFunc">Conversion function from generic message to concrete NServiceBus type</param> /// <param name="exceptionAction">Function that is called if handler exception happens, by default simply re-throws. /// Multiple calls can be done if more than 1 exception is received</param> public BaseNServiceBusHandler( IBusHandlerProvider busHandlerProvider, IBus bus, Func <TMessage, BusMessage> nServiceBusToMessageFunc, Func <BusMessage, TMessage> messageToNServiceBusFunc, Action <Exception> exceptionAction = null) { this.busHandlerProvider = busHandlerProvider; this.bus = bus; this.nServiceBusToMessageFunc = nServiceBusToMessageFunc; this.messageToNServiceBusFunc = messageToNServiceBusFunc; this.exceptionAction = exceptionAction ?? (e => { throw e; }); }
public MemoryBus(IBusHandlerProvider busHandlerProvider) { this.busHandlers = new List <IBusHandler>(busHandlerProvider.GetHandlers()); }