Skip to content

use variables from varenv for delay / rate #30

Open
@glelouet

Description

@glelouet

I think using variables is way more powerful

Since the jar execution is in the guide, it can also be modified to show how scheduling can be parametrized

I would use expressions this way :

	@Value("${schedulingtasks.report.skip:false}")
	private boolean skipReport;

	@Scheduled(fixedRateString = "${schedulingtasks.report.period:5000}", initialDelayString = "${schedulingtasks.report.delay:0}")
	public void reportCurrentTime() {
		if(skipReport) return;

And would change the invocation to have the delay modified to 10s with

java -jar target/gs-scheduling-tasks-0.1.0.jar -Dschedulingtasks.report.delay=10000

(I guess this is how to transmit the variable with jar)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions