Пример #1
0
        protected override Uri getReplyUri(ChannelGraph graph)
        {
            var channelNode = graph.FirstOrDefault(x => x.Protocol() == LightningUri.Protocol && x.Incoming && x.Mode == ChannelMode.DeliveryGuaranteed)
                              ?? graph.FirstOrDefault(x => x.Protocol() == LightningUri.Protocol && x.Incoming && x.Mode == ChannelMode.DeliveryFastWithoutGuarantee);

            if (channelNode == null)
            {
                throw new InvalidOperationException("You must have at least one incoming Lightning Queue channel for accepting replies");
            }

            return(channelNode.Channel.Address.ToLocalUri());
        }
        protected override Uri getReplyUri(ChannelGraph graph)
        {
            var channelNode = graph.FirstOrDefault(x => x.Protocol() == LightningUri.Protocol && x.Incoming);
            if (channelNode == null)
                throw new InvalidOperationException("You must have at least one incoming Lightning Queue channel for accepting replies");

            return channelNode.Channel.Address.ToLocalUri();
        }
Пример #3
0
        /// <summary>
        /// Sends a message from this node to the system under test.
        /// </summary>
        public void Send <T>(T message)
        {
            var channelNode = _systemUnderTest.FirstOrDefault(x => x.Publishes(typeof(T)));

            if (channelNode == null)
            {
                throw new ArgumentException("Cannot find destination channel for message type {0}. Have you configured the channel with AcceptsMessage()?".ToFormat(typeof(T)), "message");
            }

            Uri destination = channelNode.Uri;
            var bus         = Runtime.Get <IServiceBus>();

            bus.Send(destination, message);
        }
Пример #4
0
 private ChannelNode findDestination(Uri uri)
 {
     return(_graph.FirstOrDefault(x => x.Uri == uri) ?? _volatileNodes[uri]);
 }