public static MessageQueue Create(string path) { QueueReference qRef = QueueReference.Parse(path); IMessageQueue iMessageQueue = CreateMessageQueue(qRef, false); return(new MessageQueue(iMessageQueue)); }
private static IConnection CreateConnection(QueueReference qRef) { ConnectionFactory cf = new ConnectionFactory(); cf.Address = qRef.Host; return(cf.CreateConnection()); }
public IMessageQueue GetMessageQueue(QueueReference qRef) { qLock.AcquireReaderLock(TIMEOUT); try { if (queues.Contains(qRef)) { return((IMessageQueue)queues[qRef]); } else { LockCookie lc = qLock.UpgradeToWriterLock(TIMEOUT); try { IMessageQueue mq = new RabbitMQMessageQueue(this, qRef, false); queues[qRef] = mq; return(mq); } finally { qLock.DowngradeFromWriterLock(ref lc); } } } finally { qLock.ReleaseReaderLock(); } }
public static MessageQueue Create(string path, bool transactional) { QueueReference qRef = QueueReference.Parse(path); IMessageQueue iMessageQueue = CreateMessageQueue(qRef, transactional); return(new MessageQueue(iMessageQueue)); }
public void Equals() { QueueReference qr1 = new QueueReference("abc", "def", false); QueueReference qr2 = new QueueReference("abc", "def", false); //Assert.IsTrue(qr1.Equals(qr2), "QueueReferences should be equal"); Assert.AreEqual(qr1, qr2, "QueueReferences should be equal"); }
public static void Delete(QueueReference qRef) { RabbitMQMessagingProvider provider = (RabbitMQMessagingProvider)MessagingProviderLocator.GetProvider(); using (IMessagingContext context = provider.CreateContext(qRef.Host)) { context.Delete(qRef); } }
public RabbitMQMessageQueue (RabbitMQMessagingProvider provider, QueueReference qRef, bool transactional) { this.provider = provider; this.helper = new MessageFactory (provider); this.qRef = qRef; this.transactional = transactional; }
public bool Exists(QueueReference qRef) { qLock.AcquireReaderLock(TIMEOUT); try { return(queues.Contains(qRef)); } finally { qLock.ReleaseReaderLock(); } }
private static IMessageQueue GetMessageQueue(string path) { QueueReference qRef = QueueReference.Parse(path); IMessageQueue q = MessagingProviderLocator .GetProvider() .GetMessageQueue(qRef); return(q); }
public static void Delete(QueueReference qRef) { using (IConnection cn = CreateConnection(qRef)) { using (IModel model = cn.CreateModel()) { model.QueueDelete(qRef.Queue, false, false, false); } } }
public static void Delete (QueueReference qRef) { ConnectionFactory cf = new ConnectionFactory (); using (IConnection cn = cf.CreateConnection (qRef.Host)) { using (IModel model = cn.CreateModel ()) { model.QueueDelete (qRef.Queue, false, false, false); } } }
public void Send(QueueReference qRef, IMessage message) { IModel _model = Model; string finalName = _model.QueueDeclare(qRef.Queue, false); IMessageBuilder mb = helper.WriteMessage(_model, message); model.BasicPublish("", finalName, (IBasicProperties)mb.GetContentHeader(), mb.GetContentBody()); }
public IMessage Receive(QueueReference qRef, TimeSpan timeout, IsMatch matcher, bool ack) { if (matcher == null) { return(Receive(qRef, MessageFactory.TimeSpanToMillis(timeout), ack)); } else { return(ReceiveWithMatcher(qRef, MessageFactory.TimeSpanToMillis(timeout), matcher, ack)); } }
public IMessage Receive(QueueReference qRef, TimeSpan timeout, IsMatch matcher, bool ack) { lock (syncObj) { ValidateHost(qRef); Model.TxSelect(); isActive = true; return(Context.Receive(qRef, timeout, matcher, ack)); } }
private void ValidateHost(QueueReference qRef) { if (null == host) { host = qRef.Host; } else if (host != qRef.Host) { throw new MonoMessagingException("Transactions can not span multiple hosts"); } }
public IMessageQueue CreateMessageQueue(QueueReference qRef, bool transactional) { qLock.AcquireWriterLock(TIMEOUT); try { IMessageQueue mq = new RabbitMQMessageQueue(this, qRef, transactional); queues[qRef] = mq; return(mq); } finally { qLock.ReleaseWriterLock(); } }
public void Send(QueueReference qRef, IMessage msg) { lock (syncObj) { ValidateHost(qRef); Model.TxSelect(); isActive = true; Context.Send(qRef, msg); } }
private IMessage Receive(QueueReference qRef, int timeout, bool ack) { IModel _model = Model; string finalName = _model.QueueDeclare(qRef.Queue, false); using (Subscription sub = new Subscription(_model, finalName)) { BasicDeliverEventArgs result; if (sub.Next(timeout, out result)) { IMessage m = helper.ReadMessage(qRef, result); if (ack) { sub.Ack(result); } return(m); } else { throw new MonoMessagingException("No Message Available"); } } }
private IMessage ReceiveWithMatcher(QueueReference qRef, int timeout, IsMatch matcher, bool ack) { IModel _model = Model; string finalName = _model.QueueDeclare(qRef.Queue, false); using (Subscription sub = new Subscription(_model, finalName)) { BasicDeliverEventArgs result; while (sub.Next(timeout, out result)) { if (matcher(result)) { IMessage m = helper.ReadMessage(qRef, result); if (ack) { sub.Ack(result); } return(m); } } throw new MessageUnavailableException("Message not available"); } }
public void Parse() { string[] s = @".\def\ghi".Split(new char[] { '\\' }, 3); Assert.AreEqual(3, s.Length, "Fail"); Assert.AreEqual(".", s[0], "Fail"); QueueReference qr0 = QueueReference.Parse(@"\\host\private$\myqueue"); Assert.AreEqual("host", qr0.Host); Assert.AreEqual(true, qr0.IsPrivate); Assert.AreEqual(@"private$\myqueue", qr0.Queue); QueueReference qr1 = QueueReference.Parse(@"\\host\myqueue"); Assert.AreEqual("host", qr1.Host); Assert.AreEqual(false, qr1.IsPrivate); Assert.AreEqual("myqueue", qr1.Queue); QueueReference qr2 = QueueReference.Parse("myqueue"); Assert.AreEqual("localhost", qr2.Host); Assert.AreEqual(false, qr2.IsPrivate); Assert.AreEqual("myqueue", qr2.Queue); }
private IMessage Receive (QueueReference qRef, int timeout, bool ack) { IModel _model = Model; string finalName = _model.QueueDeclare (qRef.Queue, false); using (Subscription sub = new Subscription (_model, finalName)) { BasicDeliverEventArgs result; if (sub.Next (timeout, out result)) { IMessage m = helper.ReadMessage (qRef, result); if (ack) sub.Ack (result); return m; } else { throw new MonoMessagingException ("No Message Available"); } } }
private IMessage ReceiveWithMatcher (QueueReference qRef, int timeout, IsMatch matcher, bool ack) { IModel _model = Model; string finalName = _model.QueueDeclare (qRef.Queue, false); using (Subscription sub = new Subscription (_model, finalName)) { BasicDeliverEventArgs result; while (sub.Next (timeout, out result)) { if (matcher (result)) { IMessage m = helper.ReadMessage (qRef, result); if (ack) sub.Ack (result); return m; } } throw new MessageUnavailableException ("Message not available"); } }
public void DeleteQueue(QueueReference qRef) { throw new NotImplementedException(); }
public void Purge(QueueReference qRef) { lock (syncObj) { Context.Purge(qRef); } }
public static void Delete(string path) { QueueReference qRef = QueueReference.Parse(path); MessagingProviderLocator.GetProvider().DeleteQueue(qRef); }
public void StringLeadingChars() { Assert.AreEqual(@"asdfb\asdfasd", QueueReference.RemoveLeadingSlashes(@"\\asdfb\asdfasd"), "Failed to removed slashes"); }
public void Send (QueueReference qRef, IMessage message) { IModel _model = Model; string finalName = _model.QueueDeclare (qRef.Queue, false); IMessageBuilder mb = helper.WriteMessage (_model, message); model.BasicPublish ("", finalName, (IBasicProperties) mb.GetContentHeader (), mb.GetContentBody ()); }
private static IConnection CreateConnection (QueueReference qRef) { ConnectionFactory cf = new ConnectionFactory (); cf.Address = qRef.Host; return cf.CreateConnection (); }
public void Delete (QueueReference qRef) { Model.QueueDelete (qRef.Queue, false, false, false); }
public IMessage Receive (QueueReference qRef, TimeSpan timeout, IsMatch matcher, bool ack) { if (matcher == null) { return Receive (qRef, MessageFactory.TimeSpanToMillis (timeout), ack); } else { return ReceiveWithMatcher (qRef, MessageFactory.TimeSpanToMillis (timeout), matcher, ack); } }
public static void Delete (QueueReference qRef) { RabbitMQMessagingProvider provider = (RabbitMQMessagingProvider) MessagingProviderLocator.GetProvider (); using (IMessagingContext context = provider.CreateContext (qRef.Host)) { context.Delete (qRef); } }
public void DeleteQueue(QueueReference qRef) { RabbitMQMessageQueue.Delete(qRef); }
private static bool Exists(QueueReference qRef) { return(MessagingProviderLocator.GetProvider().Exists(qRef)); }
public void Delete(QueueReference qRef) { lock (syncObj) { Context.Delete(qRef); } }
public void Purge (QueueReference qRef) { Model.QueuePurge (qRef.Queue, false); }
public static bool Exists(string path) { return(Exists(QueueReference.Parse(path))); }
private static IMessageQueue CreateMessageQueue(QueueReference qRef, bool transactional) { return(MessagingProviderLocator.GetProvider() .CreateMessageQueue(qRef, transactional)); }
public RabbitMQMessageEnumerator(MessageFactory helper, QueueReference qRef) { this.helper = helper; this.qRef = qRef; }
public static void Delete (QueueReference qRef) { using (IConnection cn = CreateConnection (qRef)) { using (IModel model = cn.CreateModel ()) { model.QueueDelete (qRef.Queue, false, false, false); } } }