/// <summary> /// Connects an endpoint to the outbound pipeline by message type. /// </summary> /// <typeparam name="TMessage">The type of the message to route</typeparam> /// <param name="pipeline">The outbound pipeline</param> /// <param name="endpoint">The endpoint to route to</param> /// <returns></returns> public static UnsubscribeAction ConnectEndpoint <TMessage>(this IOutboundMessagePipeline pipeline, IEndpoint endpoint) where TMessage : class { var sink = new EndpointMessageSink <TMessage>(endpoint); return(pipeline.ConnectToRouter(sink)); }
public OutboundPipelineConfigurator(IServiceBus bus) { _bus = bus; var router = new MessageRouter <ISendContext>(); _pipeline = new OutboundMessagePipeline(router, this); }
public OutboundPipelineConfigurator(IServiceBus bus) { _bus = bus; var router = new MessageRouter<ISendContext>(); _pipeline = new OutboundMessagePipeline(router); }
public static UnsubscribeAction Connect <TOutput>(this IOutboundMessagePipeline pipeline, IPipelineSink <IBusPublishContext <TOutput> > sink) where TOutput : class { var routerConfigurator = new OutboundMessageRouterConfigurator(pipeline); return(routerConfigurator.FindOrCreate <TOutput>().Connect(sink)); }
public void Start(IServiceBus bus) { if (bus == null) { throw new ArgumentNullException("bus"); } _bus = bus; _pipeline = _bus.OutboundPipeline; _unregisterAction = _service.Register(this); }
public static UnsubscribeAction ConnectEndpoint <TMessage, TKey>(this IOutboundMessagePipeline pipeline, TKey correlationId, IEndpoint endpoint) where TMessage : class, ICorrelatedBy <TKey> { var correlatedConfigurator = new OutboundCorrelatedMessageRouterConfigurator(pipeline); CorrelatedMessageRouter <IBusPublishContext <TMessage>, TMessage, TKey> router = correlatedConfigurator.FindOrCreate <TMessage, TKey>(); UnsubscribeAction result = router.Connect(correlationId, new EndpointMessageSink <TMessage>(endpoint)); return(result); }
/// <summary> /// <see cref="Dispatch{T}(Burrows.Pipeline.IInboundMessagePipeline,T)"/>: this one is for the outbound pipeline. /// </summary> public static bool Dispatch <T>(this IOutboundMessagePipeline pipeline, T message, Func <T, bool> acknowledge) where T : class { bool consumed = false; var context = new SendContext <T>(message); foreach (var consumer in pipeline.Enumerate(context)) { if (!acknowledge(message)) { return(false); } acknowledge = x => true; consumed = true; consumer(context); } return(consumed); }
public void Start(IServiceBus bus) { _bus = bus; _pipeline = _bus.OutboundPipeline; _unregisterAction = _service.Register(this); }
public static IEnumerable <IPipelineSink <TMessage> > ShouldHaveSubscriptionFor <TMessage>(this IOutboundMessagePipeline pipeline) where TMessage : class { DateTime giveUpAt = DateTime.Now + Timeout; while (DateTime.Now < giveUpAt) { var inspector = new PipelineSinkLocator <TMessage>(); pipeline.Inspect(inspector); if (inspector.Result.Count() > 0) { return(inspector.Result); } Thread.Sleep(20); } Assert.Fail("A subscription for " + typeof(TMessage).ToFriendlyName() + " was not found on the pipeline"); return(null); }
public static bool Dispatch <T>(this IOutboundMessagePipeline pipeline, T message) where T : class { return(pipeline.Dispatch(message, x => true)); }