/// <summary> /// Sends the message to queue. /// </summary> /// <param name="message">The message.</param> /// <param name="messageQueueTransaction">The message queue transaction.</param> /// <returns>TransactionAction.Commit</returns> protected virtual TransactionAction SendMessageToQueue(Message message, MessageQueueTransaction messageQueueTransaction) { MessageQueue mq = MessageQueueFactory.CreateMessageQueue(MessageQueueObjectName); try { #region Logging if (LOG.IsInfoEnabled) { LOG.Info("Sending message with id = [" + message.Id + "] to queue [" + mq.Path + "]."); } #endregion ProcessExceptionalMessage(message); mq.Send(message, messageQueueTransaction); } catch (Exception e) { #region Logging if (LOG.IsErrorEnabled) { LOG.Error("Could not send message with id = [" + message.Id + "] to queue [" + mq.Path + "].", e); LOG.Error("Message will not be processed. Message Body = " + message.Body); } #endregion } return(TransactionAction.Commit); }
/// <summary> /// Sends the message to queue. /// </summary> /// <param name="message">The message.</param> protected virtual void SendMessageToQueue(Message message) { MessageQueue mq = MessageQueueFactory.CreateMessageQueue(MessageQueueObjectName); try { #region Logging if (LOG.IsInfoEnabled) { LOG.Info("Sending message with id = [" + message.Id + "] to queue [" + mq.Path + "]."); } #endregion mq.Send(message, MessageQueueTransactionType.Automatic); } catch (Exception e) { #region Logging if (LOG.IsErrorEnabled) { LOG.Error("Could not send message with id = [" + message.Id + "] to queue [" + mq.Path + "].", e); LOG.Error("Message will not be processed. Message Body = " + message.Body); } #endregion } }
private void StartMessageQueueComponents() { #region event subscriber init _domainEventProcessor = MessageQueueFactory.CreateEventSubscriber(new[] { new TopicSubscription(Consts.DemoEventTopic), }, Consts.DemoEventSubscriber, Environment.MachineName, new[] { Consts.DemoDomainEventSubscriberProvider }); _domainEventProcessor.Start(); #endregion #region EventPublisher init _messagePublisher = MessageQueueFactory.GetMessagePublisher(); _messagePublisher.Start(); #endregion }
public override IMessageQueue GetReplyQueue(Message message) { var replyQueue = MessageQueueFactory.CreateOutbound(message.ResponseAddress, MessagePattern.RequestResponse, true); return(replyQueue); }
private static void Main(string[] args) { var settingsProvider = new SettingsProvider(); var msmqFactory = new MessageQueueFactory(); var downloadFactory = new DownloadClientFactory(settingsProvider); var logger = LogManager.GetLogger(nameof(FileControlService)); var commandParser = new CommandParser(); var commandSender = new CommandSender(msmqFactory, commandParser, settingsProvider, LogManager.GetLogger(nameof(CommandSender))); var messageHandlers = new IMessageHandler[] { new FileInfoMessageHandler(downloadFactory, LogManager.GetLogger(nameof(FileInfoMessageHandler))), new ServiceInfoMessageHandler(settingsProvider, LogManager.GetLogger(nameof(ServiceInfoMessageHandler))) }; HostFactory.Run(x => { x.Service(() => new FileControlService(msmqFactory, settingsProvider, logger, commandSender, messageHandlers)); x.SetServiceName("MSMQ.StreamScanning.CentralService"); x.SetDisplayName("MSMQ StreamScanning Central Service"); x.StartAutomaticallyDelayed(); x.RunAsLocalService(); x.EnableServiceRecovery(y => y.RestartService(1).RestartService(1)); }); }
static IMessageQueueFactory CreateMessageFactory(ILogger logger) { var rabbitMqHost = ConfigurationManager.AppSettings["RabbitMqHost"]; if (string.IsNullOrWhiteSpace(rabbitMqHost)) { logger.Warn("RabbitMQ Host has not been configured. All queue based operations will not be performed."); return(MessageQueueFactory.CreateInactiveFactory()); } var messageFactory = new MessageQueueFactory(rabbitMqHost); try { logger.TraceFormat("Attempt to open connection to RabbitMQ on host \"{0}\".", rabbitMqHost); messageFactory.OpenConnection(); } catch (IOException ex) { logger.ErrorFormat(ex, "An error occurred while opening a connection to RabbitMQ on host \"{0}\".", rabbitMqHost); } if (messageFactory.IsOpen) { return(messageFactory); } logger.WarnFormat( "Unable to open a connection to RabbitMQ Host \"{0}\". All queue based operations will not be performed.", rabbitMqHost); return(MessageQueueFactory.CreateInactiveFactory()); }
private static void Main(string[] args) { var queueAddress = ".\\private$\\sixeyed.messagequeue.unsubscribe-legacy"; var properties = new Dictionary <string, object>(); properties.Add("MulticastAddress", "234.1.1.2:8001"); using (var queue = MessageQueueFactory.CreateInbound(queueAddress, MessagePattern.PublishSubscribe, properties)) { Console.WriteLine("Listening on: {0}", queueAddress); Console.WriteLine("Listening on: {0}", queueAddress); queue.Listen(x => { if (x.BodyType == typeof(UserUnsubscribed)) { var unsubscribedEvent = x.BodyAs <UserUnsubscribed>(); Console.WriteLine("Starting UnsubscribeLegacyWorkflow for: {0}, at: {1}", unsubscribedEvent.EmailAddress, DateTime.Now.TimeOfDay); var workflow = new UnsubscribeLegacyWorkflow(unsubscribedEvent.EmailAddress); workflow.Run(); Console.WriteLine("Completed UnsubscribeLegacyWorkflow for: {0}, at: {1}", unsubscribedEvent.EmailAddress, DateTime.Now.TimeOfDay); } }); } }
public void Reqest_Resonse() { using (var sender = MessageQueueFactory.CreateOutbound("ff", MessagePattern.RequestResponse)) using (var receiver = MessageQueueFactory.CreateInbound("ff", MessagePattern.RequestResponse)) { var responseQueue = sender.GetResponseQueue(); var outgoingMessage = new Message { Body = new[] { "how are you?" }, ResponseAddressName = responseQueue.MessageAddress.Address }; sender.Send(outgoingMessage); var responseMessage = new Message { Body = new[] { "I am fine, thank you." } }; receiver.Receive(incomingMessage => { var replyQueue = receiver.GetReplyQueue(incomingMessage); replyQueue.Send(responseMessage); }); string result = string.Empty; responseQueue.Receive(incomingMessage => result = incomingMessage.BodyAs <string[]>()[0]); result.Should().Be("I am fine, thank you."); } }
public void CommandBusReduceProductTest() { _commandBus = MessageQueueFactory.GetCommandBus(); _commandBus.Start(); var startTime = DateTime.Now; ReduceProduct reduceProduct = new ReduceProduct { ProductId = _createProducts[0].ProductId, ReduceCount = 1 }; var t = _commandBus.SendAsync(reduceProduct, true).Result; Console.WriteLine(t.Reply.Result); var costTime = (DateTime.Now - startTime).TotalMilliseconds; _logger.ErrorFormat("cost time : {0} ms", costTime); var products = _commandBus.SendAsync(new GetProducts { ProductIds = _createProducts.Select(p => p.ProductId).ToList() }, true).Result.ReadAsAsync <List <Project> >().Result; var success = true; Console.WriteLine(products.ToJson()); for (int i = 0; i < _createProducts.Count; i++) { success = success && products.FirstOrDefault(p => p.Id == _createProducts[i].ProductId) .Count == _createProducts[i].Count - batchCount; } Console.WriteLine($"test success {success}"); Stop(); }
public void Fire_And_Forget_Async() { using (var sender = MessageQueueFactory.CreateOutbound("ffasync", MessagePattern.FireAndForget)) using (var receiver = MessageQueueFactory.CreateInbound("ffasync", MessagePattern.FireAndForget)) { var outgoingMessage = new Message { Body = new[] { "hello world" } }; sender.Send(outgoingMessage); var cancellationTokenSource = new CancellationTokenSource(2000); var cancellationToken = cancellationTokenSource.Token; string result = string.Empty; var task = receiver.Listen(incomingMessage => { result = incomingMessage.BodyAs <string[]>()[0]; }, cancellationToken); task.Wait(); cancellationTokenSource.Cancel(); result.Should().Be("hello world"); Trace.WriteLine(result); } }
public void Pusblish_Subscribe() { using (var publisher = MessageQueueFactory.CreateOutbound("topic", MessagePattern.PublishSubscribe)) using (var subscriber1 = MessageQueueFactory.CreateInbound("subscription1", MessagePattern.PublishSubscribe)) using (var subscriber2 = MessageQueueFactory.CreateInbound("subscription2", MessagePattern.PublishSubscribe)) using (var subscriber3 = MessageQueueFactory.CreateInbound("subscription3", MessagePattern.PublishSubscribe)) { var outgoingMessage = new Message { Body = new[] { "hello world" } }; publisher.Send(outgoingMessage); string result1, result2, result3; result1 = result2 = result3 = string.Empty; subscriber1.Receive(incomingMessage => result1 = incomingMessage.BodyAs <string[]>()[0]); subscriber2.Receive(incomingMessage => result2 = incomingMessage.BodyAs <string[]>()[0]); subscriber3.Receive(incomingMessage => result3 = incomingMessage.BodyAs <string[]>()[0]); result1.Should().Be("hello world"); result2.Should().Be("hello world"); result3.Should().Be("hello world"); } }
/// <summary> /// Initializes a new instance of the <see cref="SumoLogicSink"/> class. /// </summary> /// <param name="log">The log service.</param> /// <param name="httpMessageHandler">HTTP message handler.</param> /// <param name="connection">Connection configuration.</param> /// <param name="source">Event source describer.</param> /// <param name="formatter">Text formatter.</param> public SumoLogicSink( ILog log, HttpMessageHandler httpMessageHandler, SumoLogicConnection connection, SumoLogicSource source, ITextFormatter formatter) { if (connection is null) { throw new ArgumentNullException(nameof(connection)); } if (source is null) { throw new ArgumentNullException(nameof(source)); } _formatter = formatter ?? throw new ArgumentNullException(nameof(formatter)); _log = log ?? new DummyLog(); _messageSender = MessageSenderFactory.CreateMessageSender(_log, httpMessageHandler, connection); _messageQueue = MessageQueueFactory.CreateMessageQueue(_log, connection); SumoLogicMessageSenderBufferFlushingTask flushBufferTask = FlushBufferTaskFactory.CreateFlushBufferTask( _log, _messageSender, _messageQueue, connection, source); _flushBufferTimer = new Timer( _ => flushBufferTask.Run(), null, TimeSpan.FromMilliseconds(0), connection.FlushingAccuracy); }
/// <summary> /// Receives and convert a message synchronously from the specified message queue. /// </summary> /// <param name="messageQueueObjectName">Name of the message queue object.</param> /// <returns>the converted object</returns> /// <exception cref="MessageQueueException">if thrown by MSMQ API methods. Note an /// exception will be thrown if the timeout of the syncrhonous recieve operation expires. /// </exception> public object ReceiveAndConvert(string messageQueueObjectName) { MessageQueue mq = MessageQueueFactory.CreateMessageQueue(messageQueueObjectName); Message m = mq.Receive(ReceiveTimeout); return(DoConvertMessage(m)); }
/// <summary> /// Send the given object to the specified destination, converting the object /// to a MSMQ message with a configured <see cref="IMessageConverter"/> and resolving the /// destination name to a <see cref="MessageQueue"/> with an <see cref="IMessageQueueFactory"/> /// The <see cref="MessagePostProcessorDelegate"/> callback allows for modification of the message after conversion. /// </summary> /// <param name="messageQueueObjectName">the name of the destination queue /// to send this message to (to be resolved to an actual MessageQueue /// by a IMessageQueueFactory)</param> /// <param name="obj">the object to convert to a message</param> /// <param name="messagePostProcessorDelegate">the callback to modify the message</param> /// <exception cref="MessagingException">if thrown by MSMQ API methods</exception> public void ConvertAndSend(string messageQueueObjectName, object obj, MessagePostProcessorDelegate messagePostProcessorDelegate) { Message msg = MessageConverter.ToMessage(obj); Message msgToSend = messagePostProcessorDelegate(msg); Send(MessageQueueFactory.CreateMessageQueue(messageQueueObjectName), msgToSend); }
private void StartMessageQueueComponents() { #region Command Consuemrs init var commandQueueName = $"{TopicPrefix}commandqueue"; _commandConsumer1 = MessageQueueFactory.CreateCommandConsumer(commandQueueName, "0", new[] { "CommandHandlers" }); _commandConsumer1.Start(); //_commandConsumer2 = // MessageQueueFactory.CreateCommandConsumer(commandQueueName, "1", new[] { "CommandHandlers" }); //_commandConsumer2.Start(); //_commandConsumer3 = // MessageQueueFactory.CreateCommandConsumer(commandQueueName, "2", new[] { "CommandHandlers" }); //_commandConsumer3.Start(); #endregion #region event subscriber init _domainEventProcessor = MessageQueueFactory.CreateEventSubscriber(new[] { new TopicSubscription($"{TopicPrefix}DomainEvent"), new TopicSubscription($"{TopicPrefix}ProductDomainEvent") }, "DomainEventSubscriber", Environment.MachineName, new[] { "DomainEventSubscriber" }); _domainEventProcessor.Start(); #endregion #region application event subscriber init _applicationEventProcessor = MessageQueueFactory.CreateEventSubscriber($"{TopicPrefix}AppEvent", "AppEventSubscriber", Environment.MachineName, new[] { "ApplicationEventSubscriber" }); _applicationEventProcessor.Start(); #endregion #region EventPublisher init _messagePublisher = MessageQueueFactory.GetMessagePublisher(); _messagePublisher.Start(); #endregion #region CommandBus init _commandBus = MessageQueueFactory.GetCommandBus(); _commandBus.Start(); #endregion }
public virtual IMessageQueue GetReplyQueue(Message message) { if (!(Pattern == MessagePattern.RequestResponse && Direction == Direction.Inbound)) { throw new InvalidOperationException("Cannot get a reply queue except for inbound request-response"); } return(MessageQueueFactory.CreateOutbound(message.ResponseAddressName, MessagePattern.RequestResponse, true, this)); }
public static void Bootstrap() { try { Configuration.Instance .UseLog4Net() .MessageQueueUseMachineNameFormat() .UseMessageQueue() .UseMessageStore <SampleModelContext>() //.UseKafka("localhost:2181") .UseEQueue(Utility.GetLocalIPV4().ToString()) .UseCommandBus(Environment.MachineName, linerCommandManager: new Sample.Command.LinearCommandManager()) .UseMessagePublisher("eventTopic"); _Logger = IoCFactory.Resolve <ILoggerFactory>().Create(typeof(WebApiApplication).Name); _Logger.Debug($"App Started"); #region EventPublisher init _MessagePublisher = MessageQueueFactory.GetMessagePublisher(); _MessagePublisher.Start(); #endregion #region event subscriber init _DomainEventConsumer = MessageQueueFactory.CreateEventSubscriber("DomainEvent", "DomainEventSubscriber", Environment.MachineName, "DomainEventSubscriber"); _DomainEventConsumer.Start(); #endregion #region application event subscriber init _ApplicationEventConsumer = MessageQueueFactory.CreateEventSubscriber("AppEvent", "AppEventSubscriber", Environment.MachineName, "ApplicationEventSubscriber"); _ApplicationEventConsumer.Start(); #endregion #region CommandBus init _CommandBus = MessageQueueFactory.GetCommandBus(); _CommandBus.Start(); #endregion #region Command Consuemrs init' var commandQueueName = "commandqueue"; _CommandConsumer1 = MessageQueueFactory.CreateCommandConsumer(commandQueueName, "0", "CommandHandlers"); _CommandConsumer1.Start(); _CommandConsumer2 = MessageQueueFactory.CreateCommandConsumer(commandQueueName, "1", "CommandHandlers"); _CommandConsumer2.Start(); _CommandConsumer3 = MessageQueueFactory.CreateCommandConsumer(commandQueueName, "2", "CommandHandlers"); _CommandConsumer3.Start(); #endregion } catch (Exception ex) { _Logger.Error(ex.GetBaseException().Message, ex); } }
/// <summary> /// Creates the sender. /// </summary> /// <param name="uri">The URI.</param> /// <returns></returns> public ISenderEndPoint CreateSender(Uri uri) { var messageFormatter = new TextFormatter(); var messageQueue = MessageQueueFactory.CreateQueue(uri, messageFormatter); var channel = new MsmqSenderChannel(messageQueue); return(new SenderEndPoint(uri, channel) { Logger = LoggerManager.Instance }); }
public override IMessageQueue GetReplyQueue(Message message) { if (!(Pattern == MessagePattern.RequestResponse && Direction == Direction.Inbound)) { throw new InvalidOperationException("Cannot get a reply queue except for inbound request-response"); } var responseQueue = MessageQueueFactory.CreateOutbound(message.ResponseAddress, MessagePattern.RequestResponse, true); return(responseQueue); }
public virtual IMessageQueue GetResponseQueue() { if (!(Pattern == MessagePattern.RequestResponse && Direction == Direction.Outbound)) { throw new InvalidOperationException("Cannot get a response queue except for outbound request-response"); } var address = CreateResponseQueueAddress(); return(MessageQueueFactory.CreateInbound(address, MessagePattern.RequestResponse, true, this)); }
public override IMessageQueue GetResponseQueue() { var createRequest = new CreateQueueRequest(); createRequest.QueueName = Guid.NewGuid().ToString().Substring(0, 6); var createResponse = _sqsClient.CreateQueue(createRequest); var responseQueue = MessageQueueFactory.CreateInbound(createResponse.QueueUrl, MessagePattern.RequestResponse, true); return(responseQueue); }
public override IMessageQueue GetResponseQueue() { if (!(Pattern == MessagePattern.RequestResponse && Direction == Direction.Outbound)) throw new InvalidOperationException("Cannot get a response queue except for outbound request-response"); var namespaceManager = NamespaceManager.CreateFromConnectionString(_connectionString); var responseAddress = Guid.NewGuid().ToString().Substring(0, 6); namespaceManager.CreateQueue(responseAddress); var responseQueue = MessageQueueFactory.CreateInbound(responseAddress, MessagePattern.RequestResponse, true); return responseQueue; }
/// <summary> /// Creates the receiver. /// </summary> /// <param name="uri">The URI.</param> /// <param name="numberOfParallelTasks">The number of parallel tasks.</param> /// <returns></returns> public IReceiverEndPoint CreateReceiver(Uri uri, int numberOfParallelTasks) { var messageFormatter = new TextFormatter(); var messageQueue = MessageQueueFactory.CreateQueue(uri, messageFormatter); var channel = new MsmqReceiverChannel(numberOfParallelTasks, messageQueue); var channelController = new MsmqChannelController(messageQueue); return(new ReceiverEndPoint(uri, channelController, channel) { Logger = LoggerManager.Instance }); }
/// <summary> /// Create a command server /// </summary> /// <param name="sendEndpoint">Endpoint that the server sends messages to</param> /// <param name="recvEndpoint">Endpoint that the server receives commands on</param> public CommandServer(string sendEndpoint, string recvEndpoint) { var messageQueueFactory = new MessageQueueFactory(); _sendQueue = messageQueueFactory.GetWriteOnlyQueue(sendEndpoint); _recvQueue = messageQueueFactory.GetReadOnlyQueue(recvEndpoint); // receive queue can connect straight away since it waits for incoming // connections _recvQueue.Connect(); _listenerThread = new Thread(ListenerLoop); _listenerThread.Start(); }
private static void StartUnsubscribe(string emailAddress) { var unsubscribeCommand = new UnsubscribeCommand { EmailAddress = emailAddress }; var queue = MessageQueueFactory.CreateOutbound("unsubscribe", MessagePattern.FireAndForget); queue.Send(new Message { Body = unsubscribeCommand }); }
public void CommandBusExecuteAsyncTest() { _commandBus = MessageQueueFactory.GetCommandBus(); _commandBus.Start(); var reduceProduct = new ReduceProduct { ProductId = _createProducts.First().ProductId, ReduceCount = 1 }; var result = _commandBus.ExecuteAsync(reduceProduct).Result; Stop(); }
private void SendNotificationEvent() { var unsubscribedEvent = new UserUnsubscribed { EmailAddress = EmailAddress }; var queue = MessageQueueFactory.CreateOutbound("unsubscribed-event", MessagePattern.PublishSubscribe); queue.Send(new Message { Body = unsubscribedEvent }); }
private static void Main(string[] args) { try { Configuration.Instance .UseUnityContainer() .RegisterCommonComponents() .UseLog4Net("Sample.CommandConsumer") .MessageQueueUseMachineNameFormat() .UseMessageQueue() .UseMessageStore <SampleModelContext>() .UseConfluentKafka("192.168.99.60:2181") .UseMessagePublisher("eventTopic") .RegisterEntityFrameworkComponents(); var container = IoCFactory.Instance.CurrentContainer; container.RegisterType <ICommunityRepository, CommunityRepository>(Lifetime.Hierarchical); container.RegisterType <SampleModelContext, SampleModelContext>(Lifetime.Hierarchical); #region EventPublisher init var messagePublisher = MessageQueueFactory.GetMessagePublisher(); messagePublisher.Start(); #endregion #region CommandConsumer init var commandQueueName = "commandqueue"; var commandConsumer = MessageQueueFactory.CreateCommandConsumer(commandQueueName, ObjectId.GenerateNewId().ToString(), new [] { "CommandHandlers" }, ConsumerConfig.DefaultConfig); commandConsumer.Start(); #endregion Console.ReadLine(); #region stop service commandConsumer.Stop(); messagePublisher.Stop(); #endregion } catch (Exception ex) { Console.WriteLine(ex.GetBaseException().Message); } }
public MessageQueueFactory CreateMessageQueueInstance() { var factory = new MessageQueueFactory( new MessageQueueFactory.HostOptions { HostName = configuration["MessageQueue:HostName"], VirtualHost = configuration["MessageQueue:VirtualHost"], Port = int.Parse(configuration["MessageQueue:Port"]), UserName = configuration["MessageQueue:UserName"], Password = configuration["MessageQueue:Password"] }); var cnt = -1; while (configuration.GetSection($"MessageQueue:Producers:{++cnt}").Exists()) { factory.CreateProducer(new MessageQueueFactory.ProducerOptions { Queue = configuration[$"MessageQueue:Producers:{cnt}:Queue"], Durable = bool.Parse(configuration[$"MessageQueue:Producers:{cnt}:Durable"]), AutoDelete = bool.Parse(configuration[$"MessageQueue:Producers:{cnt}:AutoDelete"]), Exclusive = bool.Parse(configuration[$"MessageQueue:Producers:{cnt}:Exclusive"]), Exchange = configuration[$"MessageQueue:Producers:{cnt}:Exchange"], RoutingKey = configuration[$"MessageQueue:Producers:{cnt}:RoutingKey"] }); } cnt = -1; while (configuration.GetSection($"MessageQueue:Consumers:{++cnt}").Exists()) { var consumer = new MessageQueueFactory.ConsumerOptions { Queue = configuration[$"MessageQueue:Consumers:{cnt}:Queue"], Durable = bool.Parse(configuration[$"MessageQueue:Consumers:{cnt}:Durable"]), AutoAck = bool.Parse(configuration[$"MessageQueue:Consumers:{cnt}:AutoAck"]), Exclusive = bool.Parse(configuration[$"MessageQueue:Consumers:{cnt}:Exclusive"]), Exchange = configuration[$"MessageQueue:Consumers:{cnt}:Exchange"], RoutingKey = configuration[$"MessageQueue:Consumers:{cnt}:RoutingKey"] }; switch (configuration[$"MessageQueue:Consumers:{cnt}:Queue"]) { case "JudgeReport": consumer.OnReceived = JudgeReport.JudgeReport_Received; Task.Run(() => JudgeReport.QueueExecutor(cancellationTokenSource.Token)); break; } factory.CreateConsumer(consumer); } return(factory); }
private static void StartMessageQueueComponents() { #region Command Consuemrs init var commandQueueName = "commandqueue"; _commandConsumer1 = MessageQueueFactory.CreateCommandConsumer(commandQueueName, "0", new[] { "CommandHandlers" }); _commandConsumer1.Start(); _commandConsumer2 = MessageQueueFactory.CreateCommandConsumer(commandQueueName, "1", new[] { "CommandHandlers" }); _commandConsumer2.Start(); _commandConsumer3 = MessageQueueFactory.CreateCommandConsumer(commandQueueName, "2", new[] { "CommandHandlers" }); _commandConsumer3.Start(); #endregion #region event subscriber init _domainEventProcessor = MessageQueueFactory.CreateEventSubscriber("DomainEvent", "DomainEventSubscriber", Environment.MachineName, new[] { "DomainEventSubscriber" }); _domainEventProcessor.Start(); #endregion #region application event subscriber init _applicationEventProcessor = MessageQueueFactory.CreateEventSubscriber("AppEvent", "AppEventSubscriber", Environment.MachineName, new[] { "ApplicationEventSubscriber" }); _applicationEventProcessor.Start(); #endregion #region EventPublisher init _messagePublisher = MessageQueueFactory.GetMessagePublisher(); _messagePublisher.Start(); #endregion #region CommandBus init _commandBus = MessageQueueFactory.GetCommandBus(); _commandBus.Start(); #endregion }
/// <summary> /// Start the <see cref="HaywireServer"/>. Initializes and starts message channels, message store and message queues. /// </summary> public void Start() { this.MessageQueues = new List<IMessageQueue>(); InitializeMessageChannel(); InitializeMessageStore(); this.queueFactory = new MessageQueueFactory(this.MessageStore, this.MessageChannel); LoadMessageQueues(); }