question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not possible to get callback on stream completion

See original GitHub issue

In the event of an error that causes the stream to close, it does not seem to be a way to be notified about this, e.g. to shut the application down. The actual Future of the stream is “hidden” inside the Future[TwitterStream] that the streaming client exposes, so the only completion one is notified about is if the initial connect succeeds or fails. Neither does it seem to be any control messages to listen to in this case.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nilsgacommented, Oct 16, 2017

What I would like to do is something like:

val streamFuture = client.filterStatuses(tracks = trackTerms)(processTweet)
streamFuture.onComplete(_ => {
  println("Done")
  System.exit(0)
})

But this does not work, since the future that is returned is the connection future, and not the stream future.

0reactions
nilsgacommented, Oct 16, 2017

Maybe. The reason I added this in addition to https://github.com/DanielaSfregola/twitter4s/issues/142 was that I had a very low volume stream, and akka streams reached an idle timeout. Not sure how these low level “protocol” exceptions would propagate to the client.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stream.pipeline() does not call the callback on completion
I use the following code to test the callback of the pipeline() function under node 12.18.0 and node 14.4.0: 'use strict'; import {pipeline, ......
Read more >
nodejs stream finish callback after pipe is not launched
You need to catch the event finish on the pipe object, not on the pdf object: console.log("saving file"); pdf .pipe( fs.createWriteStream(".
Read more >
Node.js stream.finished() Method
It can be writable i.e. When set to false, then a callback function is called when the stream ends still the stream can...
Read more >
Stream | Node.js v19.3.0 Documentation
The callback is invoked before 'finish' or on error. ... The callback is invoked if 'finish' or 'error' is emitted. ... This method...
Read more >
AsyncThrowingStream | Apple Developer Documentation
To adapt existing callback code to use async - await , use the callbacks to provide values to the stream, by using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found