Skip to main content

WorkerOptions

Struct WorkerOptions 

Source
pub struct WorkerOptions {
    pub max_concurrent_work_items: usize,
    pub max_event_names: usize,
    pub max_events_per_name: usize,
    pub max_pending_tasks_per_name: usize,
    pub max_json_payload_size: usize,
    pub max_identifier_length: usize,
    pub reconnect_policy: ReconnectPolicy,
}
Expand description

Configuration options for TaskHubGrpcWorker.

Fields§

§max_concurrent_work_items: usize

Maximum number of concurrent work items (orchestrations + activities) processed simultaneously. The worker stops accepting new work items until an in-flight task completes.

§max_event_names: usize

Maximum number of distinct event names that can be buffered per orchestration. External events arriving before the orchestrator calls wait_for_external_event are held in a per-name buffer. This cap limits the number of unique event names to prevent memory exhaustion from a flood of differently-named events.

§max_events_per_name: usize

Maximum number of events buffered per event name. When an external event arrives but no orchestrator is waiting for it yet, the event payload is queued. This cap bounds the queue depth per event name — excess events are discarded with a warning.

§max_pending_tasks_per_name: usize

Maximum number of pending wait_for_external_event tasks per event name. If an orchestrator issues more concurrent waits on the same event name than this limit, additional waits return an incomplete task.

§max_json_payload_size: usize

Maximum JSON payload size in bytes for deserialisation. Payloads exceeding this limit are rejected with an error.

§max_identifier_length: usize

Maximum allowed length (in bytes) for identifiers such as orchestrator names, activity names, instance IDs, and event names.

§reconnect_policy: ReconnectPolicy

Reconnection policy applied when the gRPC connection to the sidecar is unavailable or drops. The policy governs both the initial connection attempt and every subsequent reconnect.

Implementations§

Source§

impl WorkerOptions

Source

pub fn new() -> Self

Create options with default values.

Source

pub fn with_max_concurrent_work_items(self, limit: usize) -> Self

Set the maximum number of concurrent work items.

Source

pub fn with_max_event_names(self, limit: usize) -> Self

Set the maximum number of distinct event names buffered per orchestration.

Source

pub fn with_max_events_per_name(self, limit: usize) -> Self

Set the maximum number of events buffered per event name.

Source

pub fn with_max_pending_tasks_per_name(self, limit: usize) -> Self

Set the maximum number of pending wait tasks per event name.

Source

pub fn with_max_json_payload_size(self, limit: usize) -> Self

Set the maximum JSON payload size in bytes.

Source

pub fn with_max_identifier_length(self, limit: usize) -> Self

Set the maximum identifier length in bytes.

Source

pub fn with_reconnect_policy(self, policy: ReconnectPolicy) -> Self

Set the reconnect backoff policy.

Source

pub fn with_fast_reconnect(self) -> Self

Convenience: configure a fast reconnect policy suitable for tests.

Sets a 50 ms initial delay, 500 ms maximum delay, ×2 multiplier, and disables jitter.

Trait Implementations§

Source§

impl Clone for WorkerOptions

Source§

fn clone(&self) -> WorkerOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkerOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WorkerOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more