final AtomicInteger counter = new AtomicInteger();
final DefaultGnipFacade x = DefaultGnipFacade.createPowertrackV2Compliance(
authentication, 1);
final GnipStream stream = x.createPowertrackStream(String.class)
.withAccount("foo")
.withType("prod")
.withUnmarshall(new ComplianceActivityUnmarshaller())
.withObserver(new StreamNotificationAdapter<Activity>() {
@Override
public void notify(final Activity activity, final GnipStream stream) {
System.out.println(activity);
if (counter.incrementAndGet() >= 10) {
stream.close();
}
}
})
.build();
stream.await();