Beispiel #1
0
        public TwitterSubscription(TwitterConfig config, IObserver <StreamEvent <Tweet> > observer)
        {
            this._config           = config;
            this._twitterStreaming = new TwitterStreaming(config);
            this._sentimentService = new Sentiment140();
            this.Observer          = observer;

            new Thread(new ThreadStart(ProduceEvents)).Start();
        }
Beispiel #2
0
        public static void Dispose(TwitterConfig config)
        {
            IDisposable disp;

            if (!twitterReaderDisposers.TryGetValue(config, out disp))
            {
                return;
            }
            disp.Dispose();

            twitterReaderDisposers.Remove(config);
            twitterReaders.Remove(config);
        }
Beispiel #3
0
        public static IObservable <StreamEvent <Tweet> > Create(TwitterConfig config)
        {
            IObservable <StreamEvent <Tweet> > obs;

            if (twitterReaders.TryGetValue(config, out obs))
            {
                return(obs);
            }
            var newobs = new TwitterStreamEventObservable(config).Publish();
            var disp   = newobs.Connect();

            twitterReaderDisposers.Add(config, disp);
            twitterReaders.Add(config, newobs);
            return(newobs);
        }
Beispiel #4
0
 public TwitterStreamEventObservable(TwitterConfig config)
 {
     this._config = config;
 }
 public TwitterStreaming(TwitterConfig config)
 {
     this._config = config;
 }