private static MongoClientOptions configureMongoOptions() { final MongoClientOptions.Builder options = MongoClientOptions.builder(); for (ApplicationClass clazz : Play.classes.getAssignableClasses(MongoConfigurator.class)) { try { final MongoConfigurator configurator = (MongoConfigurator) clazz.javaClass.newInstance(); configurator.configureOptions(options); } catch (InstantiationException e) { throw new ConfigurationException( String.format("failed to create configurator: %s", clazz.name)); } catch (IllegalAccessException e) { throw new ConfigurationException( String.format("failed to create configurator: %s", clazz.name)); } } return options.build(); }
public MongoPersistWriter() { this(MongoConfigurator.detectConfiguration(StreamsConfigurator.config.getConfig("mongo"))); }