liveStream().unsubscribe crash


#1

Hi,

I’m using LiveStream example but whenever I tried liveStream().unsubscribe to stop the subscription, a java.lang.IllegalStateException: Not connected exception will be thrown. How do I stop the subscription in Java?

Regards,
CG


#2

It sounds like you are trying to unsubscribe from outside of the consumer loop (so the LiveStream consumer you are trying to unsubscribe has not actually been connected).

Are you using an unmodified example from our Java client? Which version of the client library are you using?


#3

I’m using the unmodified example from your Java client except commenting out the following 2 lines of code:

//datasift.liveStream().subscribe(new Subscription(Stream.fromString(“another-stream-hash”)));
//datasift.liveStream().subscribe(new Subscription(Stream.fromString(result.hash())));

as soon as I hit the following line:

//at some point later if you want unsubscribe
datasift.liveStream().unsubscribe(Stream.fromString(result.hash()));

the java.lang.IllegalStateException: Not connected exception will be thrown


#4

I’m using 3.0.0-beta