本文整理汇总了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);
}
}
示例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);
}
示例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)"));
}
示例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."));
}