/// <summary> /// Creates the specified configuration. /// </summary> /// <param name="gateway">The gateway to the control bus to send messages</param> /// <param name="logger">The logger to use</param> /// <param name="messageStore">The message store for outgoing messages to the control bus</param> /// <returns>IAmAControlBusSender.</returns> public IAmAControlBusSender Create(IAmAnOutbox <Message> messageStore, IAmAMessageProducer gateway) { var mapper = new MessageMapperRegistry(new SimpleMessageMapperFactory((_) => new MonitorEventMessageMapper())); mapper.Register <MonitorEvent, MonitorEventMessageMapper>(); return(new ControlBusSender(CommandProcessorBuilder.With() .Handlers(new HandlerConfiguration()) .DefaultPolicy() .TaskQueues(new MessagingConfiguration(messageStore, gateway, mapper)) .RequestContextFactory(new InMemoryRequestContextFactory()) .Build() )); }
/// <summary> /// Creates the specified configuration. /// </summary> /// <param name="logger">The logger to use</param> /// <param name="outbox">The outbox for outgoing messages to the control bus</param> /// <returns>IAmAControlBusSender.</returns> public IAmAControlBusSender Create(IAmAnOutbox <Message> outbox, IAmAProducerRegistry producerRegistry) { var mapper = new MessageMapperRegistry(new SimpleMessageMapperFactory((_) => new MonitorEventMessageMapper())); mapper.Register <MonitorEvent, MonitorEventMessageMapper>(); return(new ControlBusSender(CommandProcessorBuilder.With() .Handlers(new HandlerConfiguration()) .DefaultPolicy() .ExternalBus(new ExternalBusConfiguration(producerRegistry, mapper), outbox) .RequestContextFactory(new InMemoryRequestContextFactory()) .Build() )); }