public MessageQueue[] InitializeQueue(Endpoint queueEndpoint, QueueType queueType) { var queue = MsmqUtil.GetQueuePath(queueEndpoint).Create(); switch (queueType) { case QueueType.Standard: return(new[] { queue, MsmqUtil.OpenOrCreateQueue(GetErrorsQueuePath(), QueueAccessMode.SendAndReceive, queue), MsmqUtil.OpenOrCreateQueue(GetSubscriptionQueuePath(), QueueAccessMode.SendAndReceive, queue), MsmqUtil.OpenOrCreateQueue(GetDiscardedQueuePath(), QueueAccessMode.SendAndReceive, queue), MsmqUtil.OpenOrCreateQueue(GetTimeoutQueuePath(), QueueAccessMode.SendAndReceive, queue), }); case QueueType.LoadBalancer: return(new[] { queue, MsmqUtil.OpenOrCreateQueue(GetKnownWorkersQueuePath(), QueueAccessMode.SendAndReceive, queue), MsmqUtil.OpenOrCreateQueue(GetKnownEndpointsQueuePath(), QueueAccessMode.SendAndReceive, queue), }); default: throw new ArgumentOutOfRangeException("queueType", "Can't handle queue type: " + queueType); } }
public MessageQueue[] InitializeQueue(Endpoint queueEndpoint, QueueType queueType) { var path = MsmqUtil.GetQueuePath(queueEndpoint); return(new[] { path.Create() }); }
public void BusStarting(IServiceBus bus) { try { queueStrategy.InitializeQueue(bus.Endpoint, QueueType.Standard); } catch (Exception e) { throw new TransportException( "Could not open queue: " + bus.Endpoint + Environment.NewLine + "Queue path: " + MsmqUtil.GetQueuePath(bus.Endpoint), e); } }
public static OpenedQueue InitalizeQueue(this Endpoint endpoint) { try { return(MsmqUtil.GetQueuePath(endpoint).Open(QueueAccessMode.SendAndReceive)); } catch (Exception e) { throw new TransportException( "Could not open queue: " + endpoint + Environment.NewLine + "Queue path: " + MsmqUtil.GetQueuePath(endpoint) + Environment.NewLine + "Did you forget to create the queue or disable the queue initialization module?", e); } }
private MsmqCurrentMessageInformation CreateMessageInformation(OpenedQueue queue, Message message, object[] messages, object msg) { return(new MsmqCurrentMessageInformation { MessageId = message.GetMessageId(), AllMessages = messages, Message = msg, Queue = queue, TransportMessageId = message.Id, Destination = Endpoint.Uri, Source = MsmqUtil.GetQueueUri(message.ResponseQueue), MsmqMessage = message, TransactionType = queue.GetTransactionType() }); }
private OpenedQueue CreateSubscriptionQueue(Uri subscriptionQueueUri, QueueAccessMode accessMode) { OpenedQueue queue; try { var endpoint = endpointRouter.GetRoutedEndpoint(subscriptionQueueUri); queue = MsmqUtil.GetQueuePath(endpoint).Open(accessMode, new XmlMessageFormatter(new[] { typeof(string) })); } catch (Exception e) { throw new SubscriptionException("Could not open subscription queue (" + subscriptionQueueUri + ")", e); } return(queue); }
public MessageQueue Create() { if (IsLocal == false || Exists) { return(new MessageQueue(queuePath)); } try { return(MsmqUtil.CreateQueue(queuePath, Transactional ?? true)); } catch (Exception e) { throw new InvalidAsynchronousStateException("Could not create queue: " + QueueUri, e); } }
private void SendMessageToQueue(Message message, Endpoint endpoint) { if (HaveStarted == false) { throw new TransportException("Cannot send message before transport is started"); } try { using (var sendQueue = MsmqUtil.GetQueuePath(endpoint).Open(QueueAccessMode.Send)) { sendQueue.Send(message); logger.DebugFormat("Send message {0} to {1}", message.Label, endpoint); } } catch (Exception e) { throw new TransactionException("Failed to send message to " + endpoint, e); } }
private string GetKnownWorkersQueuePath() { var path = MsmqUtil.GetQueuePath(endpointRouter.GetRoutedEndpoint(endpoint)); return(path.QueuePath + knownWorkers); }
private string GetSubscriptionQueuePath() { var path = MsmqUtil.GetQueuePath(endpointRouter.GetRoutedEndpoint(endpoint)); return(path.QueuePath + subscriptions); }
/// <summary> /// Gets the timeout queue path. /// </summary> /// <returns></returns> private string GetTimeoutQueuePath() { var path = MsmqUtil.GetQueuePath(endpointRouter.GetRoutedEndpoint(endpoint)); return(path.QueuePath + timeout); }
/// <summary> /// Gets the discarded queue path. /// </summary> /// <returns></returns> private string GetDiscardedQueuePath() { var path = MsmqUtil.GetQueuePath(endpointRouter.GetRoutedEndpoint(endpoint)); return(path.QueuePath + discarded); }
/// <summary> /// Gets the errors queue path. /// </summary> /// <returns></returns> private string GetErrorsQueuePath() { var path = MsmqUtil.GetQueuePath(endpointRouter.GetRoutedEndpoint(endpoint)); return(path.QueuePath + errors); }