private void PersistEndpoint(OpenedQueue queue, Message message) { var queueUri = MsmqUtil.GetQueueUri(message.ResponseQueue); if (queueUri == null) { return; } bool needToPersist = knownEndpoints.Add(queueUri); if (needToPersist == false) { return; } logger.InfoFormat("Adding new endpoint: {0}", queueUri); var persistedEndPoint = new Message { Formatter = new XmlMessageFormatter(new[] { typeof(string) }), Body = queueUri.ToString(), Label = ("Known end point: " + queueUri).EnsureLabelLength() }; queue.Send(persistedEndPoint.SetSubQueueToSendTo(SubQueue.Endpoints)); SendToQueue(secondaryLoadBalancer, new NewEndpointPersisted { PersistedEndpoint = queueUri }); Raise(SentNewEndpointPersisted); }
public void Will_be_translated_correctly() { const string privateQueue = @"FormatName:PRIVATE=0786bae3-b81d-48a4-9f84-413800f09f08\00000010"; var uri = MsmqUtil.GetQueueUri(new MessageQueue(privateQueue)); Assert.Equal("msmq://0786bae3-b81d-48a4-9f84-413800f09f08/00000010", uri.ToString()); Assert.Equal(privateQueue, MsmqUtil.GetQueuePath(new Endpoint { Uri = uri }).QueuePath); }