Beispiel #1
0
 /// <summary>
 /// Publish Tick messages to ZeroMQ
 /// </summary>
 ///  <param name="tick"></param>
 public void PublishTickMessageToZeroMq(Tick tick)
 {
     try
     {
         string message = tick.Security.Symbol + "|" + tick.DataToPublish();
         _socket.Send(message, Encoding.UTF8);
         // Publish Data
         //PublishMessageToZeroMq(message);
     }
     catch (Exception exception)
     {
         Logger.Error(exception, _type.FullName, "PublishTickMessageToRabbitMq");
     }
 }
Beispiel #2
0
        /// <summary>
        /// Publishes Tick messages to MQ Exchange using native RabbitMQ
        /// </summary>
        /// <param name="replyTo">Routing Key of queue to publish</param>
        /// <param name="tick">TradeHub Tick message to be published</param>
        private void PublishTickMessageToRabbitMq(string replyTo, Tick tick)
        {
            try
            {
                // Create message bytes to be published
                byte[] responseBytes = Encoding.UTF8.GetBytes(tick.DataToPublish());

                // Publish Data
                PublishDataMessageToRabbitMq(replyTo, responseBytes);
            }
            catch (Exception exception)
            {
                Logger.Error(exception, _type.FullName, "PublishTickMessageToRabbitMq");
            }
        }
        /// <summary>
        /// Publishes Tick Data
        /// </summary>
        public void PublishTickData(Tick tick)
        {
            try
            {
                //NOTE: Using same channel and Queue to Publish both Tick and Bars
                string           corrId     = Guid.NewGuid().ToString();
                IBasicProperties replyProps = _rabbitMqTickChannel.CreateBasicProperties();
                replyProps.CorrelationId = corrId;

                // Create message bytes to be published
                byte[] responseBytes = Encoding.UTF8.GetBytes(tick.DataToPublish());

                // Publish Data
                _rabbitMqTickChannel.BasicPublish("simulated_exchange", _tickDataQueueRoutingKey, replyProps,
                                                  responseBytes);
            }
            catch (Exception exception)
            {
                Logger.Error(exception, _type.FullName, "PublishTickData");
            }
        }