コード例 #1
0
        public IMessageBusSpecifier DeclareExchange(string exchangeName, ExchangeTypes exchangeType)
        {
            var exchangePath = GetExchangePath(exchangeName);

            var mtx = GetExchangeMutex(exchangeName);

            var di = new DirectoryInfo(exchangePath);

            using (mtx)
            {
                if (mtx.Wait(TimeSpan.FromSeconds(30)))
                {
                    if (di.Exists)
                    {
                        return(this);
                    }

                    di.Create();
                    using (
                        var sw =
                            File.CreateText(Path.Combine(exchangePath,
                                                         string.Format("{0}.type", exchangeType.EnumName()))))
                    {
                        sw.Flush();
                        sw.Close();
                    }

                    mtx.Release();
                }
            }



            return(this);
        }
コード例 #2
0
 internal static string Translate(ExchangeTypes exchangeTypes)
 {
     return(exchangeTypes.EnumName());
 }