use of com.yahoo.bullet.pubsub.Publisher in project bullet-storm by yahoo.
the class DRPCPubSubTest method testQueryProcessingSingleInstanceTypes.
@Test
public void testQueryProcessingSingleInstanceTypes() throws Exception {
config.set(DRPCConfig.PUBSUB_CONTEXT_NAME, PubSub.Context.QUERY_PROCESSING.name());
DRPCPubSub pubSub = new DRPCPubSub(config);
Publisher publisher = pubSub.getPublisher();
Subscriber subscriber = pubSub.getSubscriber();
Assert.assertTrue(publisher instanceof DRPCResultPublisher);
Assert.assertTrue(subscriber instanceof DRPCQuerySubscriber);
}
use of com.yahoo.bullet.pubsub.Publisher in project bullet-storm by yahoo.
the class DRPCPubSubTest method testQuerySubmissionOneInstanceIsTheSameInstance.
@Test
public void testQuerySubmissionOneInstanceIsTheSameInstance() throws Exception {
config.set(DRPCConfig.PUBSUB_CONTEXT_NAME, PubSub.Context.QUERY_SUBMISSION.name());
DRPCPubSub pubSub = new DRPCPubSub(config);
Publisher publisher = pubSub.getPublisher();
Subscriber subscriber = pubSub.getSubscriber();
Assert.assertTrue(publisher == subscriber);
// All future calls just return the same instance
Assert.assertTrue(publisher == pubSub.getPublisher());
Assert.assertTrue(subscriber == pubSub.getSubscriber());
Assert.assertTrue(pubSub.getPublisher() == pubSub.getSubscriber());
// So do calls to get multiples after
List<Publisher> publishers = pubSub.getPublishers(42);
List<Subscriber> subscribers = pubSub.getSubscribers(20);
Assert.assertEquals(publishers.size(), 1);
Assert.assertEquals(subscribers.size(), 1);
Assert.assertEquals(publishers.get(0), publisher);
Assert.assertEquals(subscribers.get(0), subscriber);
}
use of com.yahoo.bullet.pubsub.Publisher in project bullet-storm by yahoo.
the class ResultBolt method createPublisher.
@Override
protected Publisher createPublisher() throws PubSubException {
PubSub pubSub = PubSub.from(config);
Publisher publisher = pubSub.getPublisher();
log.info("Setup PubSub: {} with Publisher: {}", pubSub, publisher);
return publisher;
}
Aggregations