question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make fetching of Job variables more convenient and DRY

See original GitHub issue

Instead of repeating variable names in the fetchVariables property of the @ZeebeWorker annotation and then later in the actual variable access, e.g.

  @ZeebeWorker(type = "myType", fetchVariables = { "orderId" } )
  public void handleJob(final JobClient client, final ActivatedJob job) {
    String orderNumber = (String) job.getVariablesAsMap().get("orderId");
  }

we could keep it DRY (Don’t Repeat Yourself) and convenient with an argument list, e.g.

  @ZeebeWorker(type = "myType")
  public void handleJob(final JobClient client, final ActivatedJob job, String orderId) {
  }

Type casting would also be done implicitly here. Not sure if the additional parameter would have to be annotated to make this work.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
berndrueckercommented, Nov 8, 2021

Or probably?

@ZeebeWorker(type = "myType") public void handleJob(final JobClient client, final ActivatedJob job, @ZeebeVariable String orderId) { }

0reactions
berndrueckercommented, Nov 17, 2021

I generally like that direction, but I am worried that this allows configuring wired things:

@ZeebeWorker(type = "myType", fetchVariables={"a", "b"}, fetchAllVariables=true)

But maybe I am too worried 😉 The above situation could raise an exception during startup as being invalid - or we simply say that “fetchAllVariables=true” always wins - which still make sense I guess

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specify variables when retrying a manual job - GitLab.org
Enter another value for the TEST_VARIABLE and run the job; The new value for TEST_VARIABLE is not echoed. The variable is empty. Im...
Read more >
Parameterized Jobs on Nomad - HashiCorp Developer
Parameterized jobs allow run-specific metadata in a job specification. Write and dispatch your first parameterized jobs on Nomad.
Read more >
Job Variables | Matillion ETL Docs
To create a job-scoped variable, right-click on the desired orchestration or transformation job within the explorer panel and select Manage Variables. This will ......
Read more >
16. Job Templates — Ansible Tower User Guide v3.8.6
A job template is a definition and set of parameters for running an Ansible job. Job templates are useful to execute the same...
Read more >
Azure Pipeline Variables | Colin's ALM Corner
The trick to making variable groups work for environment values is to keep the names the same in each variable group. That way...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found