コード例 #1
0
ファイル: Results.cs プロジェクト: pichierri/Carrot
 internal virtual AggregateConsumingResult Reply(IInboundChannel inboundChannel,
                                                 IOutboundChannel outboundChannel,
                                                 IFallbackStrategy fallbackStrategy)
 {
     Message.Acknowledge(inboundChannel);
     return this;
 }
コード例 #2
0
        void IChannelManagement.DeleteChannel(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException("id");
            }
            IOutboundChannel chan = null;

            foreach (IOutboundChannel ch in _target.OutboundChannels)
            {
                if (ch.ID == id)
                {
                    chan = ch;
                    break;
                }
            }

            if (chan != null)
            {
                if (chan.SubscribedClients > 0)
                {
                    throw new InvalidOperationException(
                              "Unable to delete channels to which there are still subscribed clients");
                }
                chan.Stop();
                _target.OutboundChannels.Remove(chan);
            }
            else
            {
                throw new LogbusException(string.Format("Channel {0} not found", id));
            }
        }
コード例 #3
0
 internal override AggregateConsumingResult Reply(IInboundChannel inboundChannel,
                                                  IOutboundChannel outboundChannel,
                                                  IFallbackStrategy fallbackStrategy)
 {
     Message.Requeue(inboundChannel);
     return(this);
 }
コード例 #4
0
 internal override AggregateConsumingResult Reply(IInboundChannel inboundChannel,
                                                  IOutboundChannel outboundChannel,
                                                  IFallbackStrategy fallbackStrategy)
 {
     fallbackStrategy.Apply(outboundChannel, Message);
     return(base.Reply(inboundChannel, outboundChannel, fallbackStrategy));
 }
コード例 #5
0
        internal virtual IOutboundChannel CreateIOutboundChannel()
        {
            // TODO: creare l'istanza di una classe concreta appropriata.
            IOutboundChannel target = ((IOutboundChannelFactory) new SimpleOutChannelFactory()).CreateChannel("dummy", "Channel for tests", new TrueFilter());

            return(target);
        }
コード例 #6
0
        public void StartTest()
        {
            IOutboundChannel target = CreateIOutboundChannel(); // TODO: Eseguire l'inizializzazione a un valore appropriato

            target.Start();
            Assert.Inconclusive("Impossibile verificare un metodo che non restituisce valori.");
        }
コード例 #7
0
 internal virtual AggregateConsumingResult Reply(IInboundChannel inboundChannel,
                                                 IOutboundChannel outboundChannel,
                                                 IFallbackStrategy fallbackStrategy)
 {
     Message.Acknowledge(inboundChannel);
     return(this);
 }
コード例 #8
0
        ChannelInformation IChannelManagement.GetChannelInformation(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException("id");
            }
            IOutboundChannel chan = null;

            foreach (IOutboundChannel ch in _target.OutboundChannels)
            {
                if (ch.ID == id)
                {
                    chan = ch;
                    break;
                }
            }

            if (chan == null)
            {
                return(null);              //Really?
            }
            return(new ChannelInformation
            {
                clients = chan.SubscribedClients.ToString(),
                coalescenceWindow = (long)chan.CoalescenceWindowMillis,
                description = chan.Description,
                filter = chan.Filter as FilterBase,
                id = chan.ID,
                title = chan.Name
            });
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of ClientSubscriptionEventArgs
 /// </summary>
 /// <param name="channel">Channel to which the client is subscribing</param>
 /// <param name="transport">Transport chosen by client</param>
 /// <param name="instructions">Instructions provided by client to the transport</param>
 protected ClientSubscriptionEventArgs(IOutboundChannel channel, string transport,
                                       IEnumerable <KeyValuePair <string, string> > instructions)
 {
     Channel                = channel;
     ChosenTransport        = transport;
     TransportConfiguration = instructions;
 }
コード例 #10
0
ファイル: Results.cs プロジェクト: naighes/Carrot
 internal override AggregateConsumingResult Reply(IInboundChannel inboundChannel,
                                                  IOutboundChannel outboundChannel,
                                                  IFallbackStrategy fallbackStrategy)
 {
     Message.Requeue(inboundChannel);
     return this;
 }
コード例 #11
0
 public FakeConsumerBase(IInboundChannel inboundChannel,
                         IOutboundChannel outboundChannel,
                         Queue queue,
                         IConsumedMessageBuilder builder,
                         ConsumingConfiguration configuration)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
 }
コード例 #12
0
 /// <remarks/>
 public OutChannelCreationEventArgs(IOutboundChannel channel)
 {
     if (channel == null)
     {
         throw new ArgumentNullException("channel");
     }
     Channel = channel;
 }
コード例 #13
0
        public void UnsubscribeClientTest()
        {
            IOutboundChannel target   = CreateIOutboundChannel(); // TODO: Eseguire l'inizializzazione a un valore appropriato
            string           clientId = string.Empty;             // TODO: Eseguire l'inizializzazione a un valore appropriato

            target.UnsubscribeClient(clientId);
            Assert.Inconclusive("Impossibile verificare un metodo che non restituisce valori.");
        }
コード例 #14
0
        public void SubscribedClientsTest()
        {
            IOutboundChannel target = CreateIOutboundChannel(); // TODO: Eseguire l'inizializzazione a un valore appropriato
            int actual;

            actual = target.SubscribedClients;
            Assert.Inconclusive("Verificare la correttezza del metodo di test.");
        }
コード例 #15
0
        public void TransportFactoryHelperTest()
        {
            IOutboundChannel        target   = CreateIOutboundChannel(); // TODO: Eseguire l'inizializzazione a un valore appropriato
            ITransportFactoryHelper expected = null;                     // TODO: Eseguire l'inizializzazione a un valore appropriato

            target.TransportFactoryHelper = expected;
            Assert.Inconclusive("Impossibile verificare proprietà in sola scrittura.");
        }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of ClientSubscribedEventArgs
 /// </summary>
 /// <param name="channel">Channel to which the client is subscribing</param>
 /// <param name="transport">Transport chosen by client</param>
 /// <param name="instructions">Instructions provided by client to the transport</param>
 /// <param name="clientId">Client ID assigned by Logbus-ng</param>
 /// <param name="outInstructions">Instructions provided by transport to client</param>
 public ClientSubscribedEventArgs(IOutboundChannel channel, string transport,
                                  IEnumerable <KeyValuePair <string, string> > instructions, string clientId,
                                  IDictionary <string, string> outInstructions)
     : base(channel, transport, instructions)
 {
     ClientId           = clientId;
     ClientInstructions = outInstructions;
 }
コード例 #17
0
 public FakeConsumerBase(IInboundChannel inboundChannel,
                         IOutboundChannel outboundChannel,
                         Queue queue,
                         IConsumedMessageBuilder builder,
                         ConsumingConfiguration configuration)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
 }
コード例 #18
0
 internal AtMostOnceConsumerWrapper(IInboundChannel inboundChannel,
                                    IOutboundChannel outboundChannel,
                                    Queue queue,
                                    IConsumedMessageBuilder builder,
                                    ConsumingConfiguration configuration)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
 }
コード例 #19
0
 internal AtMostOnceConsumerWrapper(IInboundChannel inboundChannel,
                                    IOutboundChannel outboundChannel,
                                    Queue queue,
                                    IConsumedMessageBuilder builder,
                                    ConsumingConfiguration configuration)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
 }
コード例 #20
0
ファイル: ConsumingPromise.cs プロジェクト: pichierri/Carrot
 internal override ConsumerBase BuildConsumer(IInboundChannel inboundChannel, IOutboundChannel outboundChannel)
 {
     return new LoggedAtLeastOnceConsumer(inboundChannel,
                                          outboundChannel,
                                          Queue,
                                          Builder,
                                          Configuration,
                                          LogBuilder());
 }
コード例 #21
0
ファイル: ConsumingPromise.cs プロジェクト: pichierrif/Carrot
 internal override ConsumerBase BuildConsumer(IInboundChannel inboundChannel, IOutboundChannel outboundChannel)
 {
     return(new LoggedAtLeastOnceConsumer(inboundChannel,
                                          outboundChannel,
                                          Queue,
                                          Builder,
                                          Configuration,
                                          LogBuilder()));
 }
コード例 #22
0
 internal LoggedAtLeastOnceConsumer(IInboundChannel inboundChannel,
                                    IOutboundChannel outboundChannel,
                                    Queue queue,
                                    IConsumedMessageBuilder builder,
                                    ConsumingConfiguration configuration,
                                    ILog log)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
     _log = log;
 }
コード例 #23
0
 internal Connection(RabbitMQ.Client.IConnection connection,
                     IEnumerable <ConsumerBase> consumers,
                     IOutboundChannel outboundChannel,
                     EnvironmentConfiguration configuration)
 {
     _connection      = connection;
     _consumers       = consumers;
     _outboundChannel = outboundChannel;
     Configuration    = configuration;
 }
コード例 #24
0
 internal LoggedAtMostOnceConsumer(IInboundChannel inboundChannel,
                                   IOutboundChannel outboundChannel,
                                   Queue queue,
                                   IConsumedMessageBuilder builder,
                                   ConsumingConfiguration configuration,
                                   ILog log)
     : base(inboundChannel, outboundChannel, queue, builder, configuration)
 {
     _log = log;
 }
コード例 #25
0
ファイル: ConsumerBase.cs プロジェクト: pichierri/Carrot
        protected internal ConsumerBase(IInboundChannel inboundChannel,
                                        IOutboundChannel outboundChannel,
                                        Queue queue,
                                        IConsumedMessageBuilder builder,
                                        ConsumingConfiguration configuration)
        {
            InboundChannel = inboundChannel;
            OutboundChannel = outboundChannel;
            _queue = queue;
            _builder = builder;
            Configuration = configuration;

            ConsumerCancelled += OnConsumerCancelled;
        }
コード例 #26
0
ファイル: ConsumerBase.cs プロジェクト: pichierrif/Carrot
        protected internal ConsumerBase(IInboundChannel inboundChannel,
                                        IOutboundChannel outboundChannel,
                                        Queue queue,
                                        IConsumedMessageBuilder builder,
                                        ConsumingConfiguration configuration)
        {
            InboundChannel  = inboundChannel;
            OutboundChannel = outboundChannel;
            _queue          = queue;
            _builder        = builder;
            Configuration   = configuration;

            ConsumerCancelled += OnConsumerCancelled;
        }
コード例 #27
0
        public void SubscribeClientTest()
        {
            IOutboundChannel target      = CreateIOutboundChannel();                        // TODO: Eseguire l'inizializzazione a un valore appropriato
            string           transportId = string.Empty;                                    // TODO: Eseguire l'inizializzazione a un valore appropriato
            IEnumerable <KeyValuePair <string, string> > inputInstructions          = null; // TODO: Eseguire l'inizializzazione a un valore appropriato
            IEnumerable <KeyValuePair <string, string> > outputInstructions         = null; // TODO: Eseguire l'inizializzazione a un valore appropriato
            IEnumerable <KeyValuePair <string, string> > outputInstructionsExpected = null; // TODO: Eseguire l'inizializzazione a un valore appropriato
            string expected = string.Empty;                                                 // TODO: Eseguire l'inizializzazione a un valore appropriato
            string actual;

            actual = target.SubscribeClient(transportId, inputInstructions, out outputInstructions);
            Assert.AreEqual(outputInstructionsExpected, outputInstructions);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verificare la correttezza del metodo di test.");
        }
コード例 #28
0
ファイル: Broker.cs プロジェクト: lsfera/Carrot
        protected virtual void ConnectToBroker()
        {
            if (_outboundModel != null && !_outboundModel.IsClosed) return;
            _connection = _connectionBuilder.CreateConnection(_configuration.EndpointUri);
            //Logger.DebugFormat("RMQMessagingGateway: Opening channel to Rabbit MQ on connection {0}", Configuration.AMPQUri.GetSanitizedUri());
            _outboundModel = _connection.CreateModel();
            //When AutoClose is true, the last channel to close will also cause the connection to close1. If it is set to
            //true before any channel is created, the connection will close then and there.
            if (_connection.AutoClose == false)
                _connection.AutoClose = true;

            foreach (var exchange in _exchanges)
                exchange.Declare(_outboundModel);

            foreach (var queue in _queues)
                queue.Declare(_outboundModel);

            foreach (var binding in _bindings)
                binding.Declare(_outboundModel);

            var builder = new ConsumedMessageBuilder(_configuration.SerializationConfiguration, _configuration.MessageTypeResolver);
            _outboundChannel = _configuration.OutboundChannelBuilder(_outboundModel, _configuration);
            var consumers = _promises.Select(_ =>
            {
                var model = CreateInboundModel(_connection, _configuration.PrefetchSize, _configuration.PrefetchCount);
                var consumer = _(builder).BuildConsumer(new InboundChannel(model), _outboundChannel);
                return new {Model = model, Consumer = consumer};
            })
                .ToList();

            foreach (var consumer in consumers)
                consumer.Consumer.Declare(consumer.Model);
            _consumers = consumers.Select(_ => _.Consumer);
        }
コード例 #29
0
ファイル: ConsumingPromise.cs プロジェクト: pichierrif/Carrot
 internal abstract ConsumerBase BuildConsumer(IInboundChannel inboundChannel, IOutboundChannel outboundChannel);
コード例 #30
0
 /// <summary>
 /// Required by ILogBus
 /// </summary>
 public void AddOutboundChannel(IOutboundChannel channel)
 {
     _target.AddOutboundChannel(channel);
 }
コード例 #31
0
 /// <summary>
 /// Initializes a new instance of ClientUnsubscribedEventArgs
 /// </summary>
 /// <param name="channel">Channel to which the client was subscribed</param>
 /// <param name="clientId">ID of client</param>
 public ClientUnsubscribedEventArgs(IOutboundChannel channel, string clientId)
 {
     Channel  = channel;
     ClientId = clientId;
 }
コード例 #32
0
 public void Apply(IOutboundChannel channel, ConsumedMessageBase message)
 {
 }
コード例 #33
0
ファイル: ConsumingPromise.cs プロジェクト: pichierri/Carrot
 internal abstract ConsumerBase BuildConsumer(IInboundChannel inboundChannel, IOutboundChannel outboundChannel);
コード例 #34
0
 /// <summary>
 /// Initializes a new instanceClientSubscribingEventArgs
 /// </summary>
 /// <param name="channel">Channel to which the client is subscribing</param>
 /// <param name="transport">Transport chosen by client</param>
 /// <param name="instructions">Instructions provided by client to the transport</param>
 public ClientSubscribingEventArgs(IOutboundChannel channel, string transport,
                                   IEnumerable <KeyValuePair <string, string> > instructions)
     : base(channel, transport, instructions)
 {
 }
コード例 #35
0
 public void Apply(IOutboundChannel channel, ConsumedMessageBase message)
 {
     channel.ForwardAsync(message, _exchange, String.Empty);
 }
コード例 #36
0
ファイル: Results.cs プロジェクト: pichierri/Carrot
 internal override AggregateConsumingResult Reply(IInboundChannel inboundChannel,
                                                  IOutboundChannel outboundChannel,
                                                  IFallbackStrategy fallbackStrategy)
 {
     fallbackStrategy.Apply(outboundChannel, Message);
     return base.Reply(inboundChannel, outboundChannel, fallbackStrategy);
 }
コード例 #37
0
 public void Apply(IOutboundChannel channel, ConsumedMessageBase message)
 {
     channel.ForwardAsync(message, _exchange, String.Empty);
 }
コード例 #38
0
 public void Apply(IOutboundChannel channel, ConsumedMessageBase message) { }