public MemQueueSpecifier(MemMessageBus parent, MessageExchangeDeclaration declSpec, MessageQueueDeclaration queueSpec) { _parent = parent; _declSpec = declSpec; _queueSpec = queueSpec; _queueEvent = new ManualResetEventSlim(false); }
public void Send <T>(T msg, string routeKey) { RefreshQueues(); var matchingQueues = MessageExchangeDeclaration.BindMessageToQueues(routeKey, _exchangeType, _queues); foreach (var q in matchingQueues) { var outbox = new FDMessageOutbox(_busName, _exchangeName, q); outbox.Enqueue(msg); outbox.Send(); } }
public void Send <T>(T msg, string routeKey) { RefreshQueues(); var matchingQueues = MessageExchangeDeclaration.BindMessageToQueues(routeKey, _exchangeType, _queues); foreach (var q in matchingQueues) { using (var outbox = new MemoryMappedTransferOutbox(q)) { outbox.Enqueue(new MessageQueueEnvelope(msg)); outbox.Send(); } } }
public void Send <T>(T msg, string routeKey) { RefreshQueues(); var matchingQueues = MessageExchangeDeclaration.BindMessageToQueues(routeKey, _exchangeType, _queues); foreach (var q in matchingQueues) { var queue = _queues.FirstOrDefault(s => s.Name == q); var outbox = queue as IMemQueueAccess; if (null != outbox) { outbox.Queue.Enqueue(new LightMessageQueueEnvelope(msg)); outbox.SentEvent.Set(); } } }
internal void UpdateExchange(MessageExchangeDeclaration exchangeSpec) { using (var session = DocumentStoreLocator.ResolveOrRoot(MessageBusSpecifierLocalConfig.HostConnectionString)) { var spec = session.Load <MessageExchangeDeclaration>(exchangeSpec.Name); if (null == spec) { return; } spec.Queues.Clear(); spec.Queues.AddRange(exchangeSpec.Queues); spec.Type = exchangeSpec.Type; session.SaveChanges(); } }
public IMessageBusSpecifier DeclareExchange(string exchangeName, ExchangeTypes exchangeType) { using (var session = DocumentStoreLocator.ResolveOrRoot(MessageBusSpecifierLocalConfig.HostConnectionString)) { var exNameObject = session.Load <MessageExchangeDeclaration>(exchangeName); if (exNameObject == null) { var newExchange = new MessageExchangeDeclaration { Name = exchangeName, Type = exchangeType }; session.Store(newExchange); session.SaveChanges(); } } return(this); }
public IExchangeSpecifier DeclareQueue(string queueName, params string[] boundRoutes) { var rep = DataRepositoryServiceFactory.CreateSimple <MessageExchangeDeclaration>(); _exchangeDeclaration = rep.Load(_exchangeDeclaration.Name).Item; if (null != _exchangeDeclaration) { if (!_exchangeDeclaration.Queues.Any(q => q.Name == queueName)) { var mqd = new MessageQueueDeclaration { Name = queueName, Bindings = boundRoutes.ToList() }; _exchangeDeclaration.Queues.Add(mqd); rep.Update(_exchangeDeclaration); } } return(this); }
public IExchangeSpecifier DeleteQueue(string queueName) { var rep = DataRepositoryServiceFactory.CreateSimple <MessageExchangeDeclaration>(); var qrep = DataRepositoryServiceFactory.CreateSimple <MessageQueueDeclaration>(); _exchangeDeclaration = rep.Load(_exchangeDeclaration.Name).Item; if (null != _exchangeDeclaration) { var q = _exchangeDeclaration.Queues.FirstOrDefault(tq => tq.Name == queueName); if (null != q) { _exchangeDeclaration.Queues.Remove(q); rep.Update(_exchangeDeclaration); qrep.Delete(q); } } // todo: rabbit delete exchange return(this); }
public ExchangeTopologySpecifier(MessageBusTopologySpecifier mbts, MessageExchangeDeclaration exd) { _exchangeDeclaration = exd; _messageBusTopologySpecifier = mbts; }
internal MemExchange(MemMessageBus parent, MessageExchangeDeclaration declSpec) { _parent = parent; _declSpec = declSpec; }
internal RavenExchange(RavenMessageBus parent, MessageExchangeDeclaration declSpec) { _parent = parent; _declSpec = declSpec; }