private void IntitalizeStream() { dsStream.Tables.Add(new DataTable("Stream")); activityStream = new GnipStreamReader(); activityStream.OnActivityReceived += activityStream_Received; activityStream.OnReaderExeception += activityStream_ActitivityEx; activityStream.OnDisconnect += activityStream_ForcedDisconnectEvent; }
static void Main() { streamReader = new GnipStreamReader(); streamReader.OnActivityReceived += streamReader_OnActivityReceived; streamReader.OnReaderExeception += streamReader_OnReaderException; streamReader.OnDisconnect += streamReader_OnDisconnect; streamReader.Connect(AccountName, UserName, Password, StreamLabel); while (true) { Thread.Sleep(5000); } }
private void Connect() { try { streamReader = new GnipStreamReader(); streamReader.OnReaderExeception += streamReader_OnReaderException; streamReader.OnDisconnect += streamReader_OnDisconnect; streamReader.OnJsonReceived += streamReader_OnJsonReceived; streamReader.Connect( Settings.Default.AccountName, Settings.Default.Username, Settings.Default.Password, Settings.Default.StreamLabel); } catch (Exception ex) { LogMessage("Connect Error:" + ex.Message); } }
static void Main() { try { // Initialize connection to service bus } catch (Exception ex) { Console.WriteLine("Error initializing EventHub:" + ex.Message); throw ex; } streamReader = new GnipStreamReader(); streamReader.OnActivityReceived += streamReader_OnActivityReceived; streamReader.OnReaderExeception += streamReader_OnReaderException; streamReader.OnDisconnect += streamReader_OnDisconnect; streamReader.Connect(AccountName, UserName, Password, StreamLabel); streamReader.OnJsonReceived += streamReader_OnJsonReceived; while (true) { Thread.Sleep(5000); } }
private static void streamReader_OnDisconnect(object sender) { Console.WriteLine("Disconnect detected - reconnecting!!!!"); streamReader = (GnipStreamReader)sender; streamReader.Connect(AccountName, UserName, Password, StreamLabel); }