/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="config">Adapter configuration</param>
        public StackerEdgeOutput(StackerConfig config)
        {
            ChannelFactory <IStackerCtl> stackerCtlFactory =
                new ChannelFactory <IStackerCtl>(new NetNamedPipeBinding(),
                                                 new EndpointAddress("net.pipe://" + config.StackerCtlHostName + "/" + config.StackerCtlPipeName));

            stackerCtl = stackerCtlFactory.CreateChannel();
        }
Beispiel #2
0
        public void TestTwitter()
        {
            var streamInsightInstanceName = Properties.Settings.Default.InstanceName;
            var server = Server.Create(streamInsightInstanceName);
            var application = server.CreateApplication("twittertest");

            var inputConfig = new TwitterConfig
                {
                    Username = UserNameTbx.Text,
                    Password = PasswordTbx.Text
                };

            if (FilterModeRbn.Checked)
            {
                inputConfig.Mode = TwitterMode.Filter;
                inputConfig.Parameters = "track=" + FilterParametersTbx.Text;
            }
            else if (SampleModeRbn.Checked)
                inputConfig.Mode = TwitterMode.Sample;

            var input = CepStream<Tweet>.Create("twitter", typeof(TwitterFactory), inputConfig, EventShape.Point);

            // Configure output adapter
            var outputConfig = new StackerConfig
                {
                    StackerCtlPipeName = stackerCtl1.PipeName,
                    StackerCtlHostName = "localhost"
                };

            // Create query and bind to the output adapter
            query = input.ToQuery(application, "query", "...", typeof(StackerFactory), outputConfig, EventShape.Point, StreamEventOrder.ChainOrdered);

            // Start query
            query.Start();

            // Wait until query change state
            DiagnosticView diagnosticView;
            stopFlag = false;
            do
            {
                Thread.Sleep(100);
                diagnosticView = query.Application.Server.GetDiagnosticView(query.Name);
            } while (!stopFlag && (string)diagnosticView["QueryState"] == "Running");

            // Stop query
            query.Stop();

            application.Delete();
            server.Dispose();
        }
Beispiel #3
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            var streamInsightInstanceName = Properties.Settings.Default.InstanceName;
            var server = Server.Create(streamInsightInstanceName);
            var application = server.CreateApplication("yahoofinancetest");

            // Configure output adapter
            var outputConfig = new StackerConfig
            {
                StackerCtlPipeName = stackerCtl1.PipeName,
                StackerCtlHostName = "localhost"
            };

            var inputConfig = new YahooFinanceConfig
            {
                StockSymbol = "^GSPC",
                StockName = "S&P 500",
                Timeout = 10000,
                Interval = 1000
            };

            var input = CepStream<StockQuote>.Create("yahoo", typeof(YahooFinanceFactory), inputConfig, EventShape.Point);

            // Create query and bind to the output adapter
            query = input.ToQuery(application, "query", "...", typeof(StackerFactory), outputConfig, EventShape.Point, StreamEventOrder.ChainOrdered);

            // Start query
            query.Start();

            // Wait until query change state
            DiagnosticView diagnosticView;
            stopFlag = false;
            do
            {
                Thread.Sleep(100);
                diagnosticView = query.Application.Server.GetDiagnosticView(query.Name);
            } while (!stopFlag && (string)diagnosticView["QueryState"] == "Running");

            // Stop query
            query.Stop();

            Thread.Sleep(1000);

            application.Delete();
            server.Dispose();
        }
Beispiel #4
0
        public void TestFacebook()
        {
            var streamInsightInstanceName = Properties.Settings.Default.InstanceName;
            var server = Server.Create(streamInsightInstanceName);
            var application = server.CreateApplication("facebooktest");

            var inputConfig = new FacebookConfig
            {
                AccessToken = AccessTokenTbx.Text,
                UsernameOrUniqueId = UsernameOrUniqueIdTbx.Text,
                RefreshPeriod = int.Parse(RefreshIntervalTbx.Text) * 1000
            };

            var input = CepStream<FacebookItem>.Create("facebook", typeof(FacebookFactory), inputConfig, EventShape.Point);

            // Configure output adapter
            var outputConfig = new StackerConfig
            {
                StackerCtlPipeName = stackerCtl1.PipeName,
                StackerCtlHostName = "localhost"
            };

            // Create query and bind to the output adapter
            var expr = from e in input
                       select new {e.Id, e.FromName, Message = !string.IsNullOrEmpty(e.Message) ? e.Message : e.Description };

            query = expr.ToQuery(application, "query", "...", typeof(StackerFactory), outputConfig, EventShape.Point, StreamEventOrder.FullyOrdered);

            // Start query
            query.Start();

            // Wait until query change state
            DiagnosticView diagnosticView;
            stopFlag = false;
            do
            {
                Thread.Sleep(100);
                diagnosticView = query.Application.Server.GetDiagnosticView(query.Name);
            } while (!stopFlag && (string)diagnosticView["QueryState"] == "Running");

            // Stop query
            query.Stop();

            application.Delete();
            server.Dispose();
        }