public DBGlobalCountBolt(Context ctx)
        {
            this.ctx = ctx;

            // set input schemas
            Dictionary<string, List<Type>> inputSchema = new Dictionary<string, List<Type>>();
            inputSchema.Add(Constants.DEFAULT_STREAM_ID, new List<Type>() { typeof(long) });

            //Add the Tick tuple Stream in input streams - A tick tuple has only one field of type long
            inputSchema.Add(Constants.SYSTEM_TICK_STREAM_ID, new List<Type>() { typeof(long) });

            // Declare input and output schemas
            this.ctx.DeclareComponentSchema(new ComponentStreamSchema(inputSchema, null));

            if (Context.Config.pluginConf.ContainsKey(Constants.NONTRANSACTIONAL_ENABLE_ACK))
            {
                enableAck = (bool)(Context.Config.pluginConf[Constants.NONTRANSACTIONAL_ENABLE_ACK]);
            }

            sqlConnStringBuilder = new SqlConnectionStringBuilder();
            sqlConnStringBuilder.DataSource = ConfigurationManager.AppSettings["SqlDbServerName"] + ".database.windows.net";
            sqlConnStringBuilder.InitialCatalog = ConfigurationManager.AppSettings["SqlDbDatabaseName"];
            sqlConnStringBuilder.UserID = ConfigurationManager.AppSettings["SqlDbUsername"];
            sqlConnStringBuilder.Password = ConfigurationManager.AppSettings["SqlDbPassword"];

            db = new SqlDb(sqlConnStringBuilder.ConnectionString);
            db.dropTable();
            db.createTable();

            partialCount = 0L;
            totalCount = 0L;
        }
Пример #2
0
        public DBGlobalCountBolt(Context ctx)
        {
            this.ctx = ctx;

            // set input schemas
            Dictionary <string, List <Type> > inputSchema = new Dictionary <string, List <Type> >();

            inputSchema.Add(Constants.DEFAULT_STREAM_ID, new List <Type>()
            {
                typeof(long)
            });

            //Add the Tick tuple Stream in input streams - A tick tuple has only one field of type long
            inputSchema.Add(Constants.SYSTEM_TICK_STREAM_ID, new List <Type>()
            {
                typeof(long)
            });

            // Declare input and output schemas
            this.ctx.DeclareComponentSchema(new ComponentStreamSchema(inputSchema, null));

            if (Context.Config.pluginConf.ContainsKey(Constants.NONTRANSACTIONAL_ENABLE_ACK))
            {
                enableAck = (bool)(Context.Config.pluginConf[Constants.NONTRANSACTIONAL_ENABLE_ACK]);
            }

            sqlConnStringBuilder                = new SqlConnectionStringBuilder();
            sqlConnStringBuilder.DataSource     = ConfigurationManager.AppSettings["SqlDbServerName"] + ".database.windows.net";
            sqlConnStringBuilder.InitialCatalog = ConfigurationManager.AppSettings["SqlDbDatabaseName"];
            sqlConnStringBuilder.UserID         = ConfigurationManager.AppSettings["SqlDbUsername"];
            sqlConnStringBuilder.Password       = ConfigurationManager.AppSettings["SqlDbPassword"];

            db = new SqlDb(sqlConnStringBuilder.ConnectionString);
            db.dropTable();
            db.createTable();

            partialCount = 0L;
            totalCount   = 0L;
        }