public void Push(EndpointMessage message) { if (message.PublishDelayInMiliseconds == long.MinValue) pipeline.Push(message); else scheduler.Push(message); }
public void Acknowledge(EndpointMessage message) { try { safeChannel.Channel.BasicAck(dequeuedMessages[message].DeliveryTag, false); dequeuedMessages.Remove(message); } catch (EndOfStreamException ex) { Close(); throw new EndpointClosedException(String.Format("The Endpoint '{0}' was closed", Name), ex); } catch (AlreadyClosedException ex) { Close(); throw new EndpointClosedException(String.Format("The Endpoint '{0}' was closed", Name), ex); } catch (OperationInterruptedException ex) { Close(); throw new EndpointClosedException(String.Format("The Endpoint '{0}' was closed", Name), ex); } catch (Exception) { Close(); throw; } }
public void Push(EndpointMessage message) { transport.SendMessage(this, message); }
public bool BlockDequeue(uint timeoutInMiliseconds, out EndpointMessage msg) { return transport.BlockDequeue(this, timeoutInMiliseconds, out msg); }
public void Acknowledge(EndpointMessage message) { }
public EndpointMessage DequeueNoWait() { if (consumer == null) throw new EndpointClosedException(String.Format("The Endpoint '{0}' is closed", Name)); try { var result = consumer.Queue.DequeueNoWait(null); if (result == null) return null; var msg = new EndpointMessage(result.Body, result.RoutingKey, result.BasicProperties.Headers); dequeuedMessages.Add(msg, result); return msg; } catch (EndOfStreamException ex) { Close(); throw new EndpointClosedException(String.Format("The Endpoint '{0}' was closed", Name), ex); } catch (AlreadyClosedException ex) { Close(); throw new EndpointClosedException(String.Format("The Endpoint '{0}' was closed", Name), ex); } catch (OperationInterruptedException ex) { Close(); throw new EndpointClosedException(String.Format("The Endpoint '{0}' was closed", Name), ex); } catch (Exception ex) { Close(); throw ex; } }
public bool BlockDequeue(uint timeoutInMiliseconds, out EndpointMessage msg) { msg = null; BasicDeliverEventArgs result; if (consumer == null) throw new EndpointClosedException(String.Format("The Endpoint '{0}' is closed", Name)); try { if (consumer.Queue.Dequeue((int)timeoutInMiliseconds, out result) == false) return false; msg = new EndpointMessage(result.Body, result.RoutingKey, result.BasicProperties.Headers); dequeuedMessages.Add(msg, result); return true; } catch (EndOfStreamException ex) { Close(); throw new EndpointClosedException(String.Format("The Endpoint '{0}' was closed", Name), ex); } catch (AlreadyClosedException ex) { Close(); throw new EndpointClosedException(String.Format("The Endpoint '{0}' was closed", Name), ex); } catch (OperationInterruptedException ex) { Close(); throw new EndpointClosedException(String.Format("The Endpoint '{0}' was closed", Name), ex); } catch (Exception) { Close(); throw; } }
public override void Push(EndpointMessage message) { if (ReferenceEquals(null, safeChannel)) throw new PipelineClosedException($"The Pipeline '{name}' was closed."); try { message.RoutingHeaders.Add("x-delay", message.PublishDelayInMiliseconds); IBasicProperties properties = new BasicProperties(); properties.Headers = message.RoutingHeaders; properties.Persistent = true; properties.Priority = 9; safeChannel.Channel.BasicPublish(name, message.RoutingKey, false, properties, message.Body); } catch (EndOfStreamException ex) { throw new PipelineClosedException($"The Pipeline '{name}' was closed.", ex); } catch (AlreadyClosedException ex) { throw new PipelineClosedException($"The Pipeline '{name}' was closed.", ex); } catch (OperationInterruptedException ex) { throw new PipelineClosedException($"The Pipeline '{name}' was closed.", ex); } }