Пример #1
0
 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: " + FileUtil.GetQueuePath(bus.Endpoint), e);
     }
 }
 public static OpenedQueue InitalizeQueue(this Endpoint endpoint)
 {
     try { return(FileUtil.GetQueuePath(endpoint).Open(QueueAccessMode.SendAndReceive)); }
     catch (Exception e)
     {
         throw new TransportException(
                   "Could not open queue: " + endpoint + Environment.NewLine +
                   "Queue path: " + FileUtil.GetQueuePath(endpoint) + Environment.NewLine +
                   "Did you forget to create the queue or disable the queue initialization module?", e);
     }
 }
Пример #3
0
 private void SendMessageToQueue(Message message, Endpoint endpoint)
 {
     if (HaveStarted == false)
     {
         throw new TransportException("Cannot send message before transport is started");
     }
     try
     {
         using (var sendQueue = FileUtil.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); }
 }
        public MessageQueue[] InitializeQueue(Endpoint queueEndpoint, QueueType queueType)
        {
            var path = FileUtil.GetQueuePath(queueEndpoint);

            return(new[] { path.Create() });
        }