示例#1
0
 public void stop()
 {
     if (m_consumer != null && m_consumer.isRunning())
     {
         m_consumer.stop();
     }
 }
示例#2
0
        public void run()
        {
            try
            {
                string csdl = "interaction.type == \"twitter\" and interaction.sample <= 1.0";

                m_form.deletesLog("Creating definition...");
                m_form.deletesLog("  " + csdl);
                Definition def = m_form.user.createDefinition(csdl);

                m_form.deletesLog("Creating consumer...");
                m_consumer = def.getConsumer(this, "http");

                m_form.deletesLog("Consuming...");
                m_consumer.consume();
            }
            catch (Exception e)
            {
                m_form.deletesLog(e.GetType().ToString() + ": " + e.Message);
                if (m_consumer != null)
                {
                    m_consumer.stop();
                }
            }
        }
示例#3
0
        public void onDeleted(StreamConsumer consumer, Interaction interaction, string hash)
        {
            try
            {
                m_form.deletesLog("X", false);

                m_count--;
                if (m_count == 0)
                {
                    m_form.deletesLog("\r\n\r\nStopping consumer...");
                    consumer.stop();
                }
            }
            catch (Exception e)
            {
                m_form.deletesLog(e.GetType().ToString() + ": " + e.Message);
            }
        }
示例#4
0
        public void onInteraction(StreamConsumer consumer, Interaction interaction, string hash)
        {
            try
            {
                m_form.footballLog("Type: " + interaction.getStringVal("interaction.type"));
                m_form.footballLog("Content: " + interaction.getStringVal("interaction.content"));
                m_form.footballLog("--");

                m_count--;
                if (m_count == 0)
                {
                    m_form.footballLog("Stopping consumer...");
                    consumer.stop();
                }
            }
            catch (Exception e)
            {
                m_form.footballLog(e.GetType().ToString() + ": " + e.Message);
            }
        }