コード例 #1
0
        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);
        }
コード例 #4
0
        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);
            }
        }
コード例 #6
0
        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);
        }
コード例 #8
0
        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);
 }