We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
worker
#[derive(Default)] pub struct WorkerBuilder { core_worker: Option<Arc<dyn CoreWorker>>, activities: Vec<(String, BoxActFn)>, workflows: Vec<(String, WorkflowFunction)>, data: Vec<Box<dyn Send + Sync + 'static>> } impl WorkerBuilder { pub fn builder() -> Self { Self { ..Default::default() } } pub fn register_activity<A, R, O>(mut self, activity_type: impl Into<String>, act_function: impl IntoActivityFunc<A, R, O>) -> Self { self.activities.push((activity_type.into(), act_function.into_activity_fn())); self } pub fn register_workflow(mut self, workflow_type: impl Into<String>, wf_function: impl Into<WorkflowFunction>) -> Self { self.workflows.push((workflow_type.into(), wf_function.into())); self } pub fn insert_app_data<T: Send + Sync + 'static>(mut self, data: T) -> Self { self.datum.push(Box::new(data)); self } pub async fn build(self) -> anyhow::Result<Worker> { let core_worker = self.core_worker.ok_or_else(|| anyhow!("Core worker not set"))?; let task_queue = core_worker.get_config().task_queue.clone(); let mut worker = Worker::new_from_core(core_worker, task_queue); for (activity_type, act_func) in self.activities { worker.activity_half.activity_fns.insert( activity_type, ActivityFunction { act_func, }, ); } for (workflow_type, wf_fn) in self.workflows { worker.register_wf(workflow_type, wf_fn); } for datum in self.data { worker.insert_app_data(datum); } Ok(worker) } }
The text was updated successfully, but these errors were encountered:
@bxb100 Looks like this was meant for Core SDK, right?
Sorry, something went wrong.
No branches or pull requests
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Additional context
The text was updated successfully, but these errors were encountered: