@Test public void testPropertyUpdate() { SettableConfig config = new DefaultSettableConfig(); config.setProperty("a", 1); DefaultPropertyFactory factory = new DefaultPropertyFactory(config); Iterator<Integer> it = Archaius2Ext.watch(factory, "a", Integer.class).toIterable().iterator(); assertThat(it.next()).isEqualTo(1); config.setProperty("a", 2); factory.invalidate(); assertThat(it.next()).isEqualTo(2); }
public static <T> Flux<T> watch(Property<T> property) { Flux<T> observer = Flux.create(emitter -> { Property.Subscription subscription = property.subscribe(emitter::next); emitter.onCancel(subscription::unsubscribe); }); return Flux.just(property.get()).concatWith(observer); }
Archaius2Ext { public static <T> Flux<T> watch(Property<T> property) { Flux<T> observer = Flux.create(emitter -> { Property.Subscription subscription = property.subscribe(emitter::next); emitter.onCancel(subscription::unsubscribe); }); return Flux.just(property.get()).concatWith(observer); } }
Archaius2Ext { public static <T> Flux<T> watch(Property<T> property) { Flux<T> observer = Flux.create(emitter -> { Property.Subscription subscription = property.subscribe(emitter::next); emitter.onCancel(subscription::unsubscribe); }); return Flux.just(property.get()).concatWith(observer); }  }
Archaius2Ext { public static <T> Flux<T> watch(Property<T> property) { Flux<T> observer = Flux.create(emitter -> { Property.Subscription subscription = property.subscribe(emitter::next); emitter.onCancel(subscription::unsubscribe); }); return Flux.just(property.get()).concatWith(observer); }  static Supplier<List<Duration>> asDurationList(Supplier<String> configSupplier); static Flux<T> watch(Property<T> property); static Flux<T> watch(PropertyRepository propertyRepository, String key, Class<T> type); static C newConfiguration(Class<C> configType, String... keyValuePairs); static C newConfiguration(Class<C> configType, Map<String, String> properties); static C newConfiguration(Class<C> configType, Config config); static C newConfiguration(Class<C> configType, String prefix, Config config); static C newConfiguration(Class<C> configType, Environment environment); static C newConfiguration(Class<C> configType, String prefix, Environment environment); static ObjectConfigurationResolver<OBJECT, CONFIG> newObjectConfigurationResolver(
            Config configuration,
            Function<OBJECT, String> selectorFieldAccessor,
            Class<CONFIG> configType,
            CONFIG defaultConfig); static CloseableReference<ObjectConfigurationResolver<OBJECT, CONFIG>> newObjectConfigurationResolver(
            String prefix,
            Environment environment,
            Function<OBJECT, String> selectorFieldAccessor,
            Class<CONFIG> configType,
            CONFIG defaultConfig,
            Flux<Long> updateTrigger); static String toString(Config config); }
Archaius2Ext { public static <T> Flux<T> watch(Property<T> property) { Flux<T> observer = Flux.create(emitter -> { Property.Subscription subscription = property.subscribe(emitter::next); emitter.onCancel(subscription::unsubscribe); }); return Flux.just(property.get()).concatWith(observer); }  static Supplier<List<Duration>> asDurationList(Supplier<String> configSupplier); static Flux<T> watch(Property<T> property); static Flux<T> watch(PropertyRepository propertyRepository, String key, Class<T> type); static C newConfiguration(Class<C> configType, String... keyValuePairs); static C newConfiguration(Class<C> configType, Map<String, String> properties); static C newConfiguration(Class<C> configType, Config config); static C newConfiguration(Class<C> configType, String prefix, Config config); static C newConfiguration(Class<C> configType, Environment environment); static C newConfiguration(Class<C> configType, String prefix, Environment environment); static ObjectConfigurationResolver<OBJECT, CONFIG> newObjectConfigurationResolver(
            Config configuration,
            Function<OBJECT, String> selectorFieldAccessor,
            Class<CONFIG> configType,
            CONFIG defaultConfig); static CloseableReference<ObjectConfigurationResolver<OBJECT, CONFIG>> newObjectConfigurationResolver(
            String prefix,
            Environment environment,
            Function<OBJECT, String> selectorFieldAccessor,
            Class<CONFIG> configType,
            CONFIG defaultConfig,
            Flux<Long> updateTrigger); static String toString(Config config);  }