Пример #1
0
        public IEventProcessorConfiguration RegisterEventHandlers(IMessagePump receiver, params Type[] types)
        {
            RegisterEventHandlers(receiver, new ArrayMessageHandlerRegistration <IEventHandler>(typeof(IEventHandler <>), types));

            // Continue.
            return(this);
        }
Пример #2
0
        protected MessageProcessor(
            DispatcherQueueSetting setting,
            IReliableLog <TMessage> inputMessageQueue,
            IReliableLog <OutputMessage> outputMessageQueue,
            IMessageFilteringEngine <TMessage> filteringEngine,
            IResultReporter resultReporter)
            : base(nameof(MessageProcessor <TMessage>))
        {
            this.setting            = setting;
            this.inputMessageQueue  = inputMessageQueue;
            this.outputMessageQueue = outputMessageQueue;
            this.filteringEngine    = filteringEngine;
            this.resultReporter     = resultReporter;

            this.processorComponents          = new ComponentManager(this.setting.Name, "MessageProcessorContainer");
            this.processorComponents.Faulted += (s, e) => this.Fault(e.Exception);

            this.messageDispatcher = MessageDispatcher.Create(
                this.setting,
                this.outputMessageQueue,
                this.resultReporter);
            this.processorComponents.Add(this.messageDispatcher);

            this.messagePump = MessagePump <TMessage> .Create(
                this.setting,
                this.inputMessageQueue,
                this.filteringEngine,
                this.messageDispatcher);

            this.processorComponents.Add(this.messagePump);
        }
Пример #3
0
 public SensorePressione(string descrizione = null)
 {
     Descrizione = descrizione;
     Random ran = new Random();
     Timer timer = new Timer(ran.Next(120*1000,600*1000));
     timer.Elapsed += CambiamentoPressione;
     mess = MessagePump.GetMessagePump();
 }
Пример #4
0
        public IEventProcessorConfiguration RegisterEventHandler <TEventHandler>(IMessagePump receiver)
            where TEventHandler : IEventHandler
        {
            RegisterEventHandlers(receiver, new TypeMessageHandlerRegistration <IEventHandler>(typeof(IEventHandler <>), typeof(TEventHandler)));

            // Continue.
            return(this);
        }
Пример #5
0
        //argomenti opzionali
        public Cisterna(double portata = 0, double capienza = 0)
        {
            if (portata < 0 || capienza < 0)
                throw new ArgumentException("Valore di portata o capienza non accettabile");

            Portata = portata;
            Capienza = capienza;
            _guid = new Guid();
            _mess = MessagePump.GetMessagePump();
        }
Пример #6
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     _messagePump = MessagePump.GetMessagePump();
     _notificheTextBox.Clear();
     foreach (string notifica in _messagePump.GetAllMEssages())
     {
         _notificheTextBox.AppendText(notifica + Environment.NewLine);
     }
 }
Пример #7
0
        public IEventProcessorConfiguration RegisterEventHandlers(IMessagePump receiver, IMessageHandlerRegistration <IEventHandler> registrationSource)
        {
            foreach (var registration in registrationSource.GetRegistrations())
            {
                AddMessageType(receiver, registration.Key, registration.Value.ToArray());
            }

            // Continue.
            return(this);
        }
Пример #8
0
        public MetricObject(IMonik monik, IRepository repository, IMessagePump pump)
        {
            _monik      = monik;
            _repository = repository;
            _pump       = pump;

            _dto      = null;
            _measures = null;

            window = null;
        }
Пример #9
0
        public static void Initialize(IMessagePump messagePump)
        {
            if (messagePump == null)
            {
                throw new ArgumentNullException(nameof(messagePump));
            }

            globalMessagePump = messagePump;
            globalMessagePump.MessageReceived += globalMessagePump_MessageReceived;
            messagePumpSubscription            = globalMessagePump.Start();
        }
Пример #10
0
        public static EntityManager <TEntity> Create <TEntity>(TEntity entity, IMessagePump messagePump)
            where TEntity : notnull
        {
            var idProperty = entity.GetType().GetProperty("Id");

            if (idProperty == null)
            {
                throw new InvalidOperationException("Entity has no ID and topic is not provided.");
            }

            return(Create(entity, messagePump, idProperty.GetValue(entity).ToString()));
        }
Пример #11
0
 public AGSRuntimeSettings(IGameSettings settings, IGameWindow gameWindow, IMessagePump messagePump, IGLUtils glUtils)
 {
     _glUtils = glUtils;
     _gameWindow = gameWindow;
     _messagePump = messagePump;
     Title = settings.Title;
     VirtualResolution = settings.VirtualResolution;
     Vsync = settings.Vsync;
     PreserveAspectRatio = settings.PreserveAspectRatio;
     WindowState = settings.WindowState;
     WindowBorder = settings.WindowBorder;
 }
Пример #12
0
 public AGSRuntimeSettings(IGameSettings settings, IGameWindow gameWindow, IMessagePump messagePump, IGLUtils glUtils)
 {
     _glUtils            = glUtils;
     _gameWindow         = gameWindow;
     _messagePump        = messagePump;
     Title               = settings.Title;
     VirtualResolution   = settings.VirtualResolution;
     Vsync               = settings.Vsync;
     PreserveAspectRatio = settings.PreserveAspectRatio;
     WindowState         = settings.WindowState;
     WindowBorder        = settings.WindowBorder;
 }
Пример #13
0
 public AGSGame(IGameState state, IGameEvents gameEvents, IRenderMessagePump renderMessagePump, IUpdateMessagePump updateMessagePump,
                IGraphicsBackend graphics, IGLUtils glUtils)
 {
     _renderMessagePump = renderMessagePump;
     _renderMessagePump.SetSyncContext();
     _updateMessagePump = updateMessagePump;
     State          = state;
     Events         = gameEvents;
     _relativeSpeed = state.Speed;
     _graphics      = graphics;
     _glUtils       = glUtils;
     GLUtils        = _glUtils;
 }
Пример #14
0
        public IEventProcessorConfiguration RegisterEventHandlers(IMessagePump receiver, Action <IFluentMessageHandlerRegistration <IEventHandler> > config)
        {
            // Create configuration object and call external configuration.
            var handlers = new FluentMessageHandlerRegistration <IEventHandler>(typeof(IEventHandler <>));

            config(handlers);

            // Register handlers.
            RegisterEventHandlers(receiver, handlers);

            // Continue.
            return(this);
        }
Пример #15
0
 public AGSGame(IGameState state, IGameEvents gameEvents, IMessagePump messagePump,
                IGraphicsBackend graphics, IGLUtils glUtils)
 {
     _messagePump = messagePump;
     _messagePump.SetSyncContext();
     State            = state;
     Events           = gameEvents;
     _relativeSpeed   = state.Speed;
     _renderEventArgs = new AGSEventArgs();
     _graphics        = graphics;
     _glUtils         = glUtils;
     GLUtils          = _glUtils;
 }
Пример #16
0
        public static EntityManager <TEntity> Create <TEntity>(TEntity entity, IMessagePump pump, string topic)
            where TEntity : notnull
        {
            if (string.IsNullOrWhiteSpace(topic))
            {
                throw new ArgumentOutOfRangeException(nameof(topic), $"{nameof(topic)} cannot be empty!");
            }

            var manager = new EntityManager <TEntity>(entity, topic);

            manager.Connect(pump);
            pump.Connect(topic ?? string.Empty, manager);
            return(manager);
        }
Пример #17
0
 public MessagePumpsManager(IMessagePump responseMessagePump,
                            IEnumerable <IMessagePump> requestMessagePumps,
                            IEnumerable <IMessagePump> commandMessagePumps,
                            IEnumerable <IMessagePump> multicastRequestMessagePumps,
                            IEnumerable <IMessagePump> multicastEventMessagePumps,
                            IEnumerable <IMessagePump> competingEventMessagePumps)
 {
     _responseMessagePump          = responseMessagePump;
     _commandMessagePumps          = commandMessagePumps.ToArray();
     _requestMessagePumps          = requestMessagePumps.ToArray();
     _multicastRequestMessagePumps = multicastRequestMessagePumps.ToArray();
     _multicastEventMessagePumps   = multicastEventMessagePumps.ToArray();
     _competingEventMessagePumps   = competingEventMessagePumps.ToArray();
 }
Пример #18
0
 public MessagePumpsManager(IMessagePump responseMessagePump,
                            IEnumerable<IMessagePump> requestMessagePumps,
                            IEnumerable<IMessagePump> commandMessagePumps,
                            IEnumerable<IMessagePump> multicastRequestMessagePumps,
                            IEnumerable<IMessagePump> multicastEventMessagePumps,
                            IEnumerable<IMessagePump> competingEventMessagePumps)
 {
     _responseMessagePump = responseMessagePump;
     _commandMessagePumps = commandMessagePumps.ToArray();
     _requestMessagePumps = requestMessagePumps.ToArray();
     _multicastRequestMessagePumps = multicastRequestMessagePumps.ToArray();
     _multicastEventMessagePumps = multicastEventMessagePumps.ToArray();
     _competingEventMessagePumps = competingEventMessagePumps.ToArray();
 }
Пример #19
0
        public Application(
            IMessageQueue messageQueue,
            IMessagePump messagePump,
            IMessageStore messageStore)
        {
            _messageQueue = messageQueue;
            _messagePump  = messagePump;
            _messageStore = messageStore;

            _messageHandlers = new ComputedDictionary <Guid, IMessageHandler>(
                () => new List <IMessageHandler> {
                _board
            }.Union(_board.Cards)
                .ToDictionary(h => h.GetObjectId()));
        }
Пример #20
0
        public static EntityManager <TEntity> Create <TEntity>(TEntity entity, string idPropertyName, IMessagePump pump)
            where TEntity : notnull
        {
            var idProperty = entity.GetType().GetProperty(idPropertyName)
                             ?? throw new ArgumentOutOfRangeException(nameof(idPropertyName),
                                                                      $"Property {idPropertyName} does not exist on {entity.GetType()}");
            var topic = idProperty.GetValue(entity).ToString();

            return(Create(entity, pump, topic));
        }
Пример #21
0
        /// <summary>
        /// Start the receiver.
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="handlerMap"></param>
        private void StartReceiver(IMessagePump receiver, MessageHandlerMap handlerMap)
        {
            MessagingEventSource.Log.MessageReceiverStarting(receiver, handlerMap);

            receiver.StartAsync(message => OnHandleMessage(receiver, null, message, handlerMap), OnError, 
                new ServiceBus.Receive.OnMessageOptions { AutoComplete = false }).Wait();
        }
Пример #22
0
        public static ICommandProcessorConfiguration RegisterCommandHandlers(this ICommandProcessorConfiguration configuration, IMessagePump receiver, params Type[] types)
        {
            configuration.RegisterCommandHandlers(receiver, new ArrayMessageHandlerRegistration <ICommandHandler>(typeof(ICommandHandler <>), types));

            // Continue.
            return(configuration);
        }
Пример #23
0
        public static ICommandProcessorConfiguration RegisterCommandHandler <TCommandHandler>(this ICommandProcessorConfiguration configuration, IMessagePump receiver)
            where TCommandHandler : ICommandHandler
        {
            configuration.RegisterCommandHandlers(receiver, new TypeMessageHandlerRegistration <ICommandHandler>(typeof(ICommandHandler <>), typeof(TCommandHandler)));

            // Continue.
            return(configuration);
        }
Пример #24
0
 public static Task StartAsync(this IMessagePump pump, OnMessage messageHandler)
 {
     return(pump.StartAsync(messageHandler, null, null));
 }
Пример #25
0
 public static Task StartAsync(this IMessagePump pump, OnMessage messageHandler, OnMessageException exception)
 {
     return(pump.StartAsync(messageHandler, exception, null));
 }
Пример #26
0
 public static Task StartAsync(this IMessagePump pump, OnMessage messageHandler, OnMessageOptions options)
 {
     return(pump.StartAsync(messageHandler, null, options));
 }
Пример #27
0
        public static ICommandProcessorConfiguration RegisterCommandHandlers(this ICommandProcessorConfiguration configuration, IMessagePump receiver, Action <IFluentMessageHandlerRegistration <ICommandHandler> > config)
        {
            // Create configuration object and call external configuration.
            var handlers = new FluentMessageHandlerRegistration <ICommandHandler>(typeof(ICommandHandler <>));

            config(handlers);

            // Register handlers.
            configuration.RegisterCommandHandlers(receiver, handlers);

            // Continue.
            return(configuration);
        }
Пример #28
0
 public void Connect(IMessagePump messagePump)
 {
     _messagePump = messagePump;
 }
Пример #29
0
 public NotificationPipeline(IMessagePump pump, LoadContextModel load, ProcessNotification process)
 {
     _pump    = pump;
     _load    = load;
     _process = process;
 }
Пример #30
0
        /// <summary>
        /// Start the receiver.
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="handlerMap"></param>
        private void StartReceiver(IMessagePump receiver, MessageHandlerMap handlerMap)
        {
            MessengerEventSource.Log.MessageReceiverStarting(receiver, handlerMap);

            receiver.StartAsync(message => OnHandleMessage(receiver, null, message, handlerMap), OnError).Wait();
        }
Пример #31
0
        /// <summary>
        /// Start the receiver.
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="handlerMap"></param>
        private void StartReceiver(IMessagePump receiver, MessageHandlerMap handlerMap)
        {
            MessengerEventSource.Log.MessageReceiverStarting(receiver, handlerMap);

            receiver.StartAsync(message => OnHandleMessage(receiver, null, message, handlerMap), OnError).Wait();
        }