How to set custom key-value metadata to jobs #740
-
|
I see that jobs have a meta field but it seems very strange how it works, the keys seem to be the Type ID and the value just a value. Coming from web development, I am used to work with metadata as a key-value map that I can customize I wanted to set something like "product_id": "<uuid>", so later on I could query all jobs with that metadata and set their status to "Killed" if a certain case happens (The product lifecycle is cancelled from the outside) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You should be able to easily do it using #[derive(Default, Clone)]
struct MyCtx { products: HashMap<String, UUID> }
let task: Task<String, Extensions> = TaskBuilder::new("important work".to_string())
.meta(MyCtx { products: HashMap::new() })
.build();You can then use Dependency injection via See also: |
Beta Was this translation helpful? Give feedback.
You should be able to easily do it using
MetadataExtYou can then use Dependency injection via
MetaorMetadataExt::extractSee also: