当前位置: 首页>>代码示例>>C#>>正文


C# Address.ToXmsAddress方法代码示例

本文整理汇总了C#中Address.ToXmsAddress方法的典型用法代码示例。如果您正苦于以下问题:C# Address.ToXmsAddress方法的具体用法?C# Address.ToXmsAddress怎么用?C# Address.ToXmsAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Address的用法示例。


在下文中一共展示了Address.ToXmsAddress方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Send

        public void Send(TransportMessage message, Address address)
        {
            try
            {
                XmsAddress addr = address.ToXmsAddress();
                using (var producer = provider.GetProducer(addr))
                {
                    var xmsMessage = producer.CreateBytesMessage();
                    XmsUtilities.Convert(message, xmsMessage);
                    producer.Send(xmsMessage);
                    message.Id = xmsMessage.JMSMessageID;
                   
                }
            }
            // TODO: QueueNotFoundException
            catch (Exception ex)
            {
                if (address == null)
                    throw new FailedToSendMessageException("Failed to send message.", ex);

                throw new FailedToSendMessageException(
                    string.Format("Failed to send message to address: {0}@{1}", address.Queue, address.Machine), ex);
            }
         
        }
开发者ID:sasha-uk,项目名称:NServiceBus.Xms.3,代码行数:25,代码来源:XmsMessageSender.cs

示例2: Init

 public void Init(Address address, bool transactional)
 {
     this.address = address.ToXmsAddress();
     if (PurgeOnStartup)
         XmsUtilities.Purge(this.address);
     this.useTransactions = transactional;
     this.consumerProducer = new XmsConsumerProvider(transactional);
 }
开发者ID:sasha-uk,项目名称:NServiceBus.Xms.3,代码行数:8,代码来源:XmsMessageReceiver.cs

示例3: GIVEN_existing_ns_address_WHEN_parsed_to_xms_THEN_values_match

 public void GIVEN_existing_ns_address_WHEN_parsed_to_xms_THEN_values_match()
 {
     var address = new Address("QUEUE", "MANAGER:HOSTNAME:42:CHANNEL");
     var xms = address.ToXmsAddress();
     Assert.That(xms.Queue, Is.EqualTo("QUEUE"));
     Assert.That(xms.Host.Manager, Is.EqualTo("MANAGER"));
     Assert.That(xms.Host.HostName, Is.EqualTo("HOSTNAME"));
     Assert.That(xms.Host.Port, Is.EqualTo(42));
     Assert.That(xms.Host.Channel, Is.EqualTo("CHANNEL"));
     Assert.That(xms.Host.ConnectionName, Is.EqualTo("HOSTNAME(42)"));
 }
开发者ID:sasha-uk,项目名称:NServiceBus.Xms.3,代码行数:11,代码来源:XmsAddressTest.cs

示例4: GIVEN_invalid_address_WHEN_parsing_THE_throws

 public void GIVEN_invalid_address_WHEN_parsing_THE_throws()
 {
     var address = new Address("foo", "blahhh");
     var ex = Assert.Throws<Exception>(()=>address.ToXmsAddress());
     Assert.That(ex.Message, Is.EqualTo("Unable to parse [email protected] to xms address."));
 }
开发者ID:sasha-uk,项目名称:NServiceBus.Xms.3,代码行数:6,代码来源:XmsAddressTest.cs


注:本文中的Address.ToXmsAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。