private void OnSink(MemoryBus bus, string queue, MemoryProps props)
        {
            var others = _buses.Where(b => b != bus);

            foreach (var other in others)
                other.Broadcast(queue, props);
        }
Пример #2
0
 internal void Broadcast(string queueName, MemoryProps props)
 {
     foreach (var listener in _queues[queueName])
     {
         listener(props);
     }
 }
Пример #3
0
        public void Publish(string queueName, MemoryProps props)
        {
            Broadcast(queueName, props);

            foreach (var sink in _sinks)
                sink(queueName, props);
        }
        private void OnSink(MemoryBus bus, string queue, MemoryProps props)
        {
            var others = _buses.Where(b => b != bus);

            foreach (var other in others)
            {
                other.Broadcast(queue, props);
            }
        }
Пример #5
0
        public void Publish(string queueName, MemoryProps props)
        {
            Broadcast(queueName, props);

            foreach (var sink in _sinks)
            {
                sink(queueName, props);
            }
        }
        public void OnMessage(MemoryProps props)
        {
            var routingKey = props.RoutingKey;

            if (_routingKey.IsMatch(routingKey.Split('.')) == false)
                return;

            _onReceive(props.Body);
        }
Пример #7
0
        public void Publish(string queueName, string routingKey, object message)
        {
            var json  = JsonConvert.SerializeObject(message);
            var props = new MemoryProps
            {
                RoutingKey = routingKey,
                Body       = json
            };

            Bus.Publish(queueName, props);
        }
        public void OnMessage(MemoryProps props)
        {
            var routingKey = props.RoutingKey;

            if (_routingKey.IsMatch(routingKey.Split('.')) == false)
            {
                return;
            }

            _onReceive(props.Body);
        }
Пример #9
0
        public void Query <TResponse>(string queueName, object message, Action <TResponse> callback)
        {
            var json  = JsonConvert.SerializeObject(message);
            var props = new MemoryProps
            {
                ReplyTo = Guid.NewGuid().ToString(),
                Body    = json
            };

            Action <MemoryProps> replyListener = (p) =>
            {
                var instance = JsonConvert.DeserializeObject <TResponse>(p.Body);
                callback(instance);
            };

            Bus.Add(props.ReplyTo, replyListener);
            Bus.Publish(queueName, props);
            Bus.Remove(props.ReplyTo, replyListener);
        }
Пример #10
0
 internal void Broadcast(string queueName, MemoryProps props)
 {
     foreach (var listener in _queues[queueName])
         listener(props);
 }