Example #1
0
        private void Say(string msg)
        {
            var prod = new ProducerParam();

            //be ignored
            prod.RoutingKey = AppId.CurrentUID;
            var rec_exchangeName = RecName + ".fanout";

            prod.ExchangeParam = new ChannelExchangeParam()
            {
                Name = rec_exchangeName,
                Type = ExchangeTypes.EXCHANGETYPE_FANOUT,
            };
            Trace.TraceInformation($"Say {Name}: {msg}");
            CoreConnection.Publish(prod, Encoding.UTF8.GetBytes(msg), null);
        }
Example #2
0
 private void Say(string msg)
 {
     try
     {
         var prod = new ProducerParam();
         //be ignored
         prod.RoutingKey = RecID;
         var rec_exchangeName = RecName + ".direct";
         prod.ExchangeParam = new ChannelExchangeParam()
         {
             Name = rec_exchangeName,
             Type = ExchangeTypes.EXCHANGETYPE_DIRECT,
         };
         Trace.TraceInformation($"Say {Name}: {msg}");
         CoreConnection.Publish(prod, Encoding.UTF8.GetBytes(msg), null);
     }
     catch (Exception ex)
     {
         Trace.TraceError(ex.ToString());
     }
 }