예제 #1
0
        /// <summary>
        /// Creates the section from the node information.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext">Configuration context object.</param>
        /// <param name="section"></param>
        /// <returns>The created section handler object.</returns>
        public object Create(object parent, object configContext, XmlNode section)
        {
            Configuration configuration = new Configuration();

            ConfigurationParser.DoConfigure(configuration, section);
            return(configuration);
        }
예제 #2
0
        /// <summary>
        /// Creates the section from the node information.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext">Configuration context object.</param>
        /// <param name="section"></param>
        /// <returns>The created section handler object.</returns>
        public object Create(object parent, object configContext, XmlNode section)
        {
            var configuration = new Configuration(_container);

            _container.Resolve <IConfigurationParser>()
            .DoConfigure(configuration, (XmlElement)section);
            return(configuration);
        }
예제 #3
0
        private static void InitializeNesper()
        {
            nesperConf = new com.espertech.esper.client.Configuration();
            nesperConf.AddEventType(typeof(Feed));

            epService = EPServiceProviderManager.GetDefaultProvider(nesperConf);
            _runtime  = epService.EPRuntime;
            mHandler  = new MessageHandler();
            mHandler.UpdatePrediction += Predict;
        }
예제 #4
0
        private static void InitializeNesper()
        {
            nesperConf = new com.espertech.esper.client.Configuration();
            nesperConf.AddEventType(typeof(Feed));

            epService = EPServiceProviderManager.GetDefaultProvider(nesperConf);
            _runtime = epService.EPRuntime;
            mHandler = new MessageHandler();
            mHandler.UpdatePrediction += Predict;
        }
예제 #5
0
            public void Init(int sleepListenerMillis)
            {
                Configuration configuration = new Configuration();

                configuration.EngineDefaults.EventMetaConfig.ClassPropertyResolutionStyle =
                    PropertyResolutionStyle.CASE_INSENSITIVE;
                configuration.AddEventType("Market", typeof(MarketData));
                EPServiceProvider epService = EPServiceProviderManager.GetProvider("benchmark", configuration);

                epAdministrator = epService.EPAdministrator;
                epRuntime       = epService.EPRuntime;
                sleepMillis     = sleepListenerMillis;
            }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EngineInstance"/> class.
        /// </summary>
        public EngineInstance()
        {
            Id = Guid.NewGuid().ToString();

            var appConfiguration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            var catConfiguration = appConfiguration.Sections.OfType <CatalystConfiguration>().FirstOrDefault();

            if (catConfiguration == null)
            {
                Log.Warn("catalyst configuration section was not found");
            }

            // create the schema fabricator
            SchemaFabricator = new SchemaFabricator(new AssemblyName(Id));

            // create the service instance
            var serviceConfiguration = new com.espertech.esper.client.Configuration();

            ServiceProvider = EPServiceProviderManager.GetDefaultProvider(serviceConfiguration);

            if (catConfiguration != null)
            {
                // consumers
                Log.Info("EngineInstance.ctor: initializing consumers");
                if (catConfiguration.Consumers != null)
                {
                    var eventConsumers = new List <IEventConsumer>();

                    _eventConsumers = eventConsumers;
                    foreach (var consumerElement in catConfiguration.Consumers.OfType <ConsumerElement>())
                    {
                        var eventConsumer = consumerElement.CreateConsumer();
                        eventConsumer.SchemaFabricator = SchemaFabricator;
                        eventConsumer.XmlEvent        += SendEvent;
                        eventConsumer.DictionaryEvent += (name, @event) => SendEvent(@event, name);
                        eventConsumer.DataEvent       += SendEvent;
                        eventConsumers.Add(eventConsumer);
                    }
                }

                DataPublicationEndpoints = _eventConsumers
                                           .Select(consumer => consumer.Uri)
                                           .ToList();

                // publishers
                Log.Info("EngineInstance.ctor: initializing publishers");
                if (catConfiguration.Publishers != null)
                {
                    _eventPublisherFactories = catConfiguration.Publishers.OfType <PublisherElement>()
                                               .Select(publisherElement => publisherElement.CreatePublisherFactory())
                                               .ToList();
                }
                else
                {
                    _eventPublisherFactories = new List <IEventPublisherFactory>
                    {
                        new MsmqEventPublisherFactory(
                            string.Format(@".\private$\esper_{0}", Id))
                    };
                }
            }
            else
            {
                DataPublicationEndpoints = new List <Uri>();
            }

            Log.Info("EngineInstance.ctor: finished");
        }