I'm attempting to create a dataflow template, and within the template have a variable ValueProvider<DateTime> now such that now is the time the dataflow is started, note the time that the template was created.
My first attempt was ValueProvider<DateTime> now = StaticValueProvider.of( DateTime.now(DateTimeZone.UTC)); My second attempt was public interface MyOptions extends PipelineOptions, DataflowPipelineOptions { @Description("Now") @Default.InstanceFactory(GetNow.class) ValueProvider<DateTime> getNow(); void setNow(ValueProvider<DateTime> value); } static class GetNow implements DefaultValueFactory<DateTime> { @Override public DateTime create(PipelineOptions options) { return DateTime.now(DateTimeZone.UTC); } } ValueProvider<DateTime> now = options.getNow() My final attempt was: ValueProvider<SerializableFunction<Void, DateTime>> nowFn = StaticValueProvider.of(x -> DateTime.now(DateTimeZone.UTC)); ValueProvider<DateTime> now = NestedValueProvider.of(nowFn, x -> x.apply(null)); In every case, it was clear that "now" was being set to template-creation time rather than actual runtime. I note that the documentation talks about a RuntimeValueProvider, but there is no user-visible constructor for this.