@Override protected Publisher createPublisher() throws PubSubException { PubSub pubSub = PubSub.from(config); // Map is always not null and is validated to be a proper BulletStormConfig Map<String, Object> overrides = (Map<String, Object>) config.getAs(BulletStormConfig.LOOP_BOLT_PUBSUB_OVERRIDES, Map.class); log.info("Loaded pubsub overrides: {}", overrides); BulletStormConfig modified = new BulletStormConfig(config); overrides.forEach(modified::set); pubSub.switchContext(PubSub.Context.QUERY_SUBMISSION, modified); log.info("Switched the PubSub into query submission mode"); Publisher publisher = pubSub.getPublisher(); log.info("Setup PubSub: {} with Publisher: {}", pubSub, publisher); return publisher; }
@Override protected Publisher createPublisher() throws PubSubException { PubSub pubSub = PubSub.from(config); // Map is always not null and is validated to be a proper BulletStormConfig Map<String, Object> overrides = (Map<String, Object>) config.getAs(BulletStormConfig.LOOP_BOLT_PUBSUB_OVERRIDES, Map.class); log.info("Loaded pubsub overrides: {}", overrides); BulletStormConfig modified = new BulletStormConfig(config); overrides.forEach(modified::set); pubSub.switchContext(PubSub.Context.QUERY_SUBMISSION, modified); log.info("Switched the PubSub into query submission mode"); Publisher publisher = pubSub.getPublisher(); log.info("Setup PubSub: {} with Publisher: {}", pubSub, publisher); return publisher; }
@Override public void switchContext(Context context, BulletConfig config) throws PubSubException { super.switchContext(context, config); this.publisher = new CustomPublisher(context); this.subscriber = new CustomSubscriber(context); }