Direct access mode is recommended only for testing purposes.
Subscriber sub = p.createSubscriber(); sub.connect(); sub.subscribeStream(“stream1"); while (true) { SubscriberEvent event = sub.getNextEvent(); handleEvent(event); }