Safe Haskell | None |
---|---|
Language | Haskell2010 |
Temporal.Workflow
Description
This module provides the core functionality for defining functions that can be executed as Temporal workflows.
In day-to-day conversations, the term Workflow frequently denotes either a Workflow Type, a Workflow Definition, or a Workflow Execution.
What is a Workflow Definition?
A Workflow Definition is the code that defines the constraints of a Workflow Execution.
A Workflow Definition is often also referred to as a Workflow Function. In Temporal's documentation, a Workflow Definition refers to the source for the instance of a Workflow Execution, while a Workflow Function refers to the source for the instance of a Workflow Function Execution.
A Workflow Execution effectively executes once to completion, while a Workflow Function Execution occurs many times during the life of a Workflow Execution.
Deterministic constraints
A critical aspect of developing Workflow Definitions is ensuring they exhibit certain deterministic traits – that is, making sure that the same Commands are emitted in the same sequence, whenever a corresponding Workflow Function Execution (instance of the Function Definition) is re-executed.
The execution semantics of a Workflow Execution include the re-execution of a Workflow Function, which is called a Replay. The use of Workflow APIs in the function is what generates Commands. Commands tell the Cluster which Events to create and add to the Workflow Execution's Event History. When a Workflow Function executes, the Commands that are emitted are compared with the existing Event History. If a corresponding Event already exists within the Event History that maps to the generation of that Command in the same sequence, and some specific metadata of that Command matches with some specific metadata of the Event, then the Function Execution progresses.
For example, using an SDK's "Execute Activity" API generates the ScheduleActivityTask Command. When this API is called upon re-execution, that Command is compared with the Event that is in the same location within the sequence. The Event in the sequence must be an ActivityTaskScheduled Event, where the Activity name is the same as what is in the Command.
If a generated Command doesn't match what it needs to in the existing Event History, then the Workflow Execution returns a non-deterministic error.
The following are the two reasons why a Command might be generated out of sequence or the wrong Command might be generated altogether:
- Code changes are made to a Workflow Definition that is in use by a running Workflow Execution.
- There is intrinsic non-deterministic logic (such as inline random branching).
Code changes can cause non-deterministic behavior
The Workflow Definition can change in very limited ways once there is a Workflow Execution depending on it. To alleviate non-deterministic issues that arise from code changes, we recommend using Workflow Versioning.
For example, let's say we have a Workflow Definition that defines the following sequence:
- Start and wait on a Timer/sleep.
- Spawn and wait on an Activity Execution.
- Complete.
We start a Worker and spawn a Workflow Execution that uses that Workflow Definition. The Worker would emit the StartTimer Command and the Workflow Execution would become suspended.
Before the Timer is up, we change the Workflow Definition to the following sequence:
- Spawn and wait on an Activity Execution.
- Start and wait on a Timer/sleep.
- Complete.
When the Timer fires, the next Workflow Task will cause the Workflow Function to re-execute. The first Command the Worker sees would be ScheduleActivityTask Command, which wouldn't match up to the expected TimerStarted Event.
The Workflow Execution would fail and return a non-deterministic error.
The following are examples of minor changes that would not result in non-determinism errors when re-executing a History which already contain the Events:
- Changing the duration of a Timer
Changing the arguments to:
- The Activity Options in a call to spawn an Activity Execution (local or nonlocal).
- The Child Workflow Options in a call to spawn a Child Workflow Execution.
- Call to Signal an External Workflow Execution.
- Adding a Signal Handler for a Signal Type that has not been sent to this Workflow Execution.
Workflow Versioning
Note: not yet implemented
The Workflow Versioning feature enables the creation of logical branching inside a Workflow Definition based on a developer specified version identifier. This feature is useful for Workflow Definition logic needs to be updated, but there are running Workflow Executions that currently depends on it. It is important to note that a practical way to handle different versions of Workflow Definitions, without using the versioning API, is to run the different versions on separate Task Queues.
Handling unreliable Worker Processes
You do not handle Worker Process failure or restarts in a Workflow Definition.
Workflow Function Executions are completely oblivious to the Worker Process in terms of failures or downtime. The Temporal Platform ensures that the state of a Workflow Execution is recovered and progress resumes if there is an outage of either Worker Processes or the Temporal Cluster itself. The only reason a Workflow Execution might fail is due to the code throwing an error or exception, not because of underlying infrastructure outages.
Synopsis
- data Workflow a
- data WorkflowDefinition = WorkflowDefinition {
- workflowName :: Text
- workflowRun :: Vector Payload -> IO (Either String (Workflow Payload))
- data KnownWorkflow (args :: [Type]) result = FunctionSupportsCodec codec args result => KnownWorkflow {
- knownWorkflowCodec :: codec
- knownWorkflowName :: Text
- data ProvidedWorkflow f = ProvidedWorkflow {
- definition :: WorkflowDefinition
- reference :: KnownWorkflow (ArgsOf f) (ResultOf Workflow f)
- provideWorkflow :: forall codec f. (f ~ (ArgsOf f :->: Workflow (ResultOf Workflow f)), FunctionSupportsCodec codec (ArgsOf f) (ResultOf Workflow f)) => codec -> Text -> (RequireCallStackImpl => f) -> ProvidedWorkflow f
- data Task a
- newtype StartToClose = StartToClose Duration
- newtype ScheduleToClose = ScheduleToClose Duration
- data These a b
- class ActivityRef f where
- type ActivityArgs f :: [Type]
- type ActivityResult f
- activityRef :: f -> KnownActivity (ActivityArgs f) (ActivityResult f)
- data KnownActivity (args :: [Type]) result = FunctionSupportsCodec codec args result => KnownActivity {
- knownActivityCodec :: codec
- knownActivityName :: Text
- data StartActivityOptions = StartActivityOptions {}
- data ActivityCancellationType
- data ActivityTimeoutPolicy
- class StartActivityTimeoutOption a where
- defaultStartActivityOptions :: StartActivityTimeoutOption timeout => timeout -> StartActivityOptions
- startActivity :: (RequireCallStack, ActivityRef activity) => activity -> StartActivityOptions -> ActivityArgs activity :->: Workflow (Task (ActivityResult activity))
- executeActivity :: (RequireCallStack, ActivityRef activity) => activity -> StartActivityOptions -> ActivityArgs activity :->: Workflow (ActivityResult activity)
- data StartLocalActivityOptions = StartLocalActivityOptions {}
- defaultStartLocalActivityOptions :: StartLocalActivityOptions
- startLocalActivity :: (RequireCallStack, ActivityRef act) => act -> StartLocalActivityOptions -> ActivityArgs act :->: Workflow (Task (ActivityResult act))
- data StartChildWorkflowOptions = StartChildWorkflowOptions {
- cancellationType :: ChildWorkflowCancellationType
- parentClosePolicy :: ParentClosePolicy
- timeoutOptions :: TimeoutOptions
- retryPolicy :: Maybe RetryPolicy
- cronSchedule :: Maybe Text
- initialMemo :: Map Text Payload
- searchAttributes :: Map SearchAttributeKey SearchAttributeType
- headers :: Map Text Payload
- workflowIdReusePolicy :: WorkflowIdReusePolicy
- workflowId :: Maybe WorkflowId
- taskQueue :: Maybe TaskQueue
- defaultChildWorkflowOptions :: StartChildWorkflowOptions
- class WorkflowRef f where
- type WorkflowArgs f :: [Type]
- type WorkflowResult f
- workflowRef :: f -> KnownWorkflow (WorkflowArgs f) (WorkflowResult f)
- startChildWorkflow :: (RequireCallStack, WorkflowRef wf) => wf -> StartChildWorkflowOptions -> WorkflowArgs wf :->: Workflow (ChildWorkflowHandle (WorkflowResult wf))
- executeChildWorkflow :: (RequireCallStack, WorkflowRef wf) => wf -> StartChildWorkflowOptions -> WorkflowArgs wf :->: Workflow (WorkflowResult wf)
- data ChildWorkflowHandle result
- class Wait h where
- type WaitResult h
- wait :: h -> WaitResult h
- class Cancel h where
- type CancelResult h
- cancel :: h -> CancelResult h
- class WorkflowHandle (h :: k -> Type) where
- signal :: forall ref (result :: k). (SignalRef ref, RequireCallStack) => h result -> ref -> SignalArgs ref :->: Workflow (Task ())
- waitChildWorkflowResult :: RequireCallStack => ChildWorkflowHandle result -> Workflow result
- waitChildWorkflowStart :: RequireCallStack => ChildWorkflowHandle result -> Workflow ()
- cancelChildWorkflowExecution :: RequireCallStack => ChildWorkflowHandle result -> Workflow ()
- data ExternalWorkflowHandle result
- getExternalWorkflowHandle :: RequireCallStack => WorkflowId -> Maybe RunId -> Workflow (ExternalWorkflowHandle result)
- data Info = Info {
- historyLength :: !Word32
- attempt :: !Int
- continuedRunId :: !(Maybe RunId)
- cronSchedule :: !(Maybe Text)
- executionTimeout :: !(Maybe Duration)
- headers :: !(Map Text Payload)
- namespace :: !Namespace
- parent :: !(Maybe ParentInfo)
- rawMemo :: !(Map Text Payload)
- retryPolicy :: !(Maybe RetryPolicy)
- runId :: !RunId
- runTimeout :: !(Maybe Duration)
- searchAttributes :: !(Map SearchAttributeKey SearchAttributeType)
- startTime :: !SystemTime
- taskQueue :: !TaskQueue
- taskTimeout :: !Duration
- workflowId :: !WorkflowId
- workflowType :: !WorkflowType
- continueAsNewSuggested :: !Bool
- data RetryPolicy = RetryPolicy {}
- defaultRetryPolicy :: RetryPolicy
- data ParentInfo = ParentInfo {}
- info :: Workflow Info
- getMemoValues :: Workflow (Map Text Payload)
- lookupMemoValue :: Text -> Workflow (Maybe Payload)
- upsertSearchAttributes :: RequireCallStack => Map SearchAttributeKey SearchAttributeType -> Workflow ()
- patched :: RequireCallStack => PatchId -> Workflow Bool
- deprecatePatch :: RequireCallStack => PatchId -> Workflow ()
- race :: RequireCallStack => Workflow a -> Workflow b -> Workflow (Either a b)
- race_ :: RequireCallStack => Workflow a -> Workflow b -> Workflow ()
- concurrently :: Workflow a -> Workflow b -> Workflow (a, b)
- concurrently_ :: Workflow a -> Workflow b -> Workflow ()
- mapConcurrently :: Traversable t => (a -> Workflow b) -> t a -> Workflow (t b)
- mapConcurrently_ :: Foldable t => (a -> Workflow b) -> t a -> Workflow ()
- replicateConcurrently :: Int -> Workflow a -> Workflow [a]
- replicateConcurrently_ :: Int -> Workflow a -> Workflow ()
- forConcurrently :: Traversable t => t a -> (a -> Workflow b) -> Workflow (t b)
- forConcurrently_ :: Foldable t => t a -> (a -> Workflow b) -> Workflow ()
- traverseConcurrently :: Traversable t => (a -> Workflow b) -> t a -> Workflow (t b)
- traverseConcurrently_ :: Foldable t => (a -> Workflow b) -> t a -> Workflow ()
- sequenceConcurrently :: Traversable t => t (Workflow a) -> Workflow (t a)
- sequenceConcurrently_ :: Foldable t => t (Workflow a) -> Workflow ()
- newtype ConcurrentWorkflow a = ConcurrentWorkflow {}
- independently :: Workflow a -> Workflow b -> Workflow (a, b)
- biselect :: RequireCallStack => Workflow (Either a b) -> Workflow (Either a c) -> Workflow (Either a (b, c))
- biselectOpt :: RequireCallStack => (l -> Either a b) -> (r -> Either a c) -> (a -> t) -> ((b, c) -> t) -> Workflow l -> Workflow r -> Workflow t
- class QueryRef query where
- type QueryArgs query :: [Type]
- type QueryResult query
- queryRef :: query -> KnownQuery (QueryArgs query) (QueryResult query)
- data Query a
- data KnownQuery (args :: [Type]) result = (Codec codec result, ApplyPayloads codec args, GatherArgs codec args) => KnownQuery {
- queryName :: Text
- queryCodec :: codec
- setQueryHandler :: (QueryRef query, f ~ (QueryArgs query :->: Query (QueryResult query)), RequireCallStack) => query -> f -> Workflow ()
- class SignalRef sig where
- type SignalArgs sig :: [Type]
- signalRef :: sig -> KnownSignal (SignalArgs sig)
- data KnownSignal (args :: [Type]) = (ApplyPayloads codec args, GatherArgs codec args) => KnownSignal {
- signalName :: Text
- signalCodec :: codec
- setSignalHandler :: (ValidSignalHandler f, RequireCallStack, SignalRef ref, ArgsOf f ~ SignalArgs ref) => ref -> f -> Workflow ()
- type ValidSignalHandler f = (ResultOf Workflow f ~ (), (ArgsOf f :->: Workflow ()) ~ f)
- data Condition a
- waitCondition :: RequireCallStack => Condition Bool -> Workflow ()
- unsafeAsyncEffectSink :: RequireCallStack => IO () -> Workflow ()
- data StateVar a
- newStateVar :: a -> Workflow (StateVar a)
- class MonadReadStateVar (m :: Type -> Type) where
- readStateVar :: StateVar a -> m a
- class MonadWriteStateVar (m :: Type -> Type) where
- writeStateVar :: StateVar a -> a -> m ()
- modifyStateVar :: StateVar a -> (a -> a) -> m ()
- now :: Workflow UTCTime
- time :: RequireCallStack => Workflow SystemTime
- sleep :: RequireCallStack => Duration -> Workflow ()
- data Timer
- createTimer :: Duration -> Workflow (Maybe Timer)
- scheduledTime :: Workflow (Maybe UTCTime)
- isCancelRequested :: RequireCallStack => Workflow Bool
- waitCancellation :: RequireCallStack => Workflow ()
- randomGen :: Workflow WorkflowGenM
- uuid4 :: Workflow UUID
- uuid7 :: RequireCallStack => Workflow UUID
- data WorkflowGenM
- data ContinueAsNewOptions = ContinueAsNewOptions {}
- defaultContinueAsNewOptions :: ContinueAsNewOptions
- continueAsNew :: WorkflowRef wf => wf -> ContinueAsNewOptions -> WorkflowArgs wf :->: Workflow (WorkflowResult wf)
- type GatherArgs codec (args :: [Type]) = (VarArgs args, AllArgs (Codec codec) args)
- newtype ActivityId = ActivityId {}
- newtype WorkflowId = WorkflowId {}
- newtype Namespace = Namespace {
- rawNamespace :: Text
- newtype TaskQueue = TaskQueue {
- rawTaskQueue :: Text
- newtype PatchId = PatchId {
- rawPatchId :: Text
- newtype RunId = RunId {}
- data ParentClosePolicy
- data ChildWorkflowCancellationType
- data WorkflowIdReusePolicy
- newtype WorkflowType = WorkflowType {}
- type RequireCallStack = (HasCallStack, RequireCallStackImpl)
- data TimeoutOptions = TimeoutOptions {}
- defaultTimeoutOptions :: TimeoutOptions
- type family (args :: [Type]) :->: result where ...
Documentation
The Workflow monad is a constrained execution environment that helps developers write code that can be executed deterministically and reliably.
If a Workflow execution is interrupted, for example due to a server failure, or otherwise fails to complete, the Temporal service will automatically replay the Workflow execution up to the point of interruption with the same inputs at each step in the function.
The st
state may be used to store information that is needed to respond to
any queries or signals that are received by the Workflow execution.
Workflow code must be deterministic. This means:
- no threading
- no randomness
- no external calls to processes
- no network I/O
- no global state mutation
- no system date or time
This might seem like a lot of restrictions, but Temporal provides a number of functions that allow you to use similar functionality in a deterministic way.
A critical aspect of developing Workflow Definitions is ensuring they exhibit certain deterministic traits – that is, making sure that the same Commands are emitted in the same sequence, whenever a corresponding Workflow Function Execution (instance of the Function Definition) is re-executed.
Instances
data WorkflowDefinition Source #
This is a Workflow function that can be called from the outside world.
You can create a definition via provideWorkflow
.
To make a worker use this definition, you must add it to the WorkerConfig
via addWorkflow
.
Constructors
WorkflowDefinition | |
Fields
|
Instances
WorkflowDef WorkflowDefinition Source # | |
Defined in Temporal.Workflow.Definition Methods workflowDefinition :: WorkflowDefinition -> WorkflowDefinition Source # | |
ToDefinitions env WorkflowDefinition Source # | |
Defined in Temporal.Worker Methods toDefinitions :: WorkflowDefinition -> Definitions env Source # |
data KnownWorkflow (args :: [Type]) result Source #
A KnownWorkflow
is a handle that contains all the information needed to start a
Workflow either as a child workflow or as a top-level workflow via a Client
.
Constructors
FunctionSupportsCodec codec args result => KnownWorkflow | |
Fields
|
Instances
UseAsInWorkflowProxy ProxyAsync (KnownWorkflow args res) Source # | |||||||||
Defined in Temporal.Bundle Methods useAsInWorkflowProxy :: ProxyAsync -> KnownWorkflow args res -> (RefStartOptions @@ KnownWorkflow args res) -> InWorkflowProxies ProxyAsync @@ KnownWorkflow args res Source # | |||||||||
UseAsInWorkflowProxy ProxySync (KnownWorkflow args res) Source # | |||||||||
Defined in Temporal.Bundle Methods useAsInWorkflowProxy :: ProxySync -> KnownWorkflow args res -> (RefStartOptions @@ KnownWorkflow args res) -> InWorkflowProxies ProxySync @@ KnownWorkflow args res Source # | |||||||||
FieldToStartOptionDefaults (KnownWorkflow args res) Source # | |||||||||
Defined in Temporal.Bundle Methods refStartOptionsDefaults :: Proxy (KnownWorkflow args res) -> StartActivityOptions -> StartChildWorkflowOptions -> RefStartOptionsType (KnownWorkflow args res) Source # | |||||||||
WorkflowRef (KnownWorkflow args result) Source # | |||||||||
Defined in Temporal.Workflow.Definition Associated Types
Methods workflowRef :: KnownWorkflow args result -> KnownWorkflow (WorkflowArgs (KnownWorkflow args result)) (WorkflowResult (KnownWorkflow args result)) Source # | |||||||||
type Eval (InWorkflowProxies ProxyAsync (KnownWorkflow args res) :: Type -> Type) Source # | |||||||||
Defined in Temporal.Bundle type Eval (InWorkflowProxies ProxyAsync (KnownWorkflow args res) :: Type -> Type) = args :->: Workflow (ChildWorkflowHandle res) | |||||||||
type Eval (InWorkflowProxies ProxySync (KnownWorkflow args res) :: Type -> Type) Source # | |||||||||
Defined in Temporal.Bundle type Eval (InWorkflowProxies ProxySync (KnownWorkflow args res) :: Type -> Type) = args :->: Workflow res | |||||||||
type WorkflowArgs (KnownWorkflow args result) Source # | |||||||||
Defined in Temporal.Workflow.Definition | |||||||||
type WorkflowResult (KnownWorkflow args result) Source # | |||||||||
Defined in Temporal.Workflow.Definition |
data ProvidedWorkflow f Source #
Constructors
ProvidedWorkflow | |
Fields
|
Instances
ToDefinitions env (ProvidedWorkflow f) Source # | |||||||||
Defined in Temporal.Worker Methods toDefinitions :: ProvidedWorkflow f -> Definitions env Source # | |||||||||
WorkflowDef (ProvidedWorkflow f) Source # | |||||||||
Defined in Temporal.Workflow.Definition Methods workflowDefinition :: ProvidedWorkflow f -> WorkflowDefinition Source # | |||||||||
VarArgs (ArgsOf f) => WorkflowRef (ProvidedWorkflow f) Source # | |||||||||
Defined in Temporal.Workflow.Definition Associated Types
Methods workflowRef :: ProvidedWorkflow f -> KnownWorkflow (WorkflowArgs (ProvidedWorkflow f)) (WorkflowResult (ProvidedWorkflow f)) Source # | |||||||||
type WorkflowArgs (ProvidedWorkflow f) Source # | |||||||||
Defined in Temporal.Workflow.Definition | |||||||||
type WorkflowResult (ProvidedWorkflow f) Source # | |||||||||
Defined in Temporal.Workflow.Definition |
provideWorkflow :: forall codec f. (f ~ (ArgsOf f :->: Workflow (ResultOf Workflow f)), FunctionSupportsCodec codec (ArgsOf f) (ResultOf Workflow f)) => codec -> Text -> (RequireCallStackImpl => f) -> ProvidedWorkflow f Source #
A utility function for constructing a WorkflowDefinition
from a function as well as
a KnownWorkflow
value. This is useful for keeping the argument, codec, and result types
in sync with each other so that changes to the function are reflected at their use sites.
myWorkflow :: Workflow () () Int myWorkflow = pure 1 myWorkflowDef :: ProvidedWorkflow () () Int myWorkflowDef = provideWorkflow JSON -- codec @"myWorkflow" -- visible name of the workflow () -- initial state myWorkflow -- the workflow function
An async action handle that can be awaited or cancelled.
Instances
Applicative Task Source # | |||||
Functor Task Source # | |||||
Cancel (Task a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
| |||||
Wait (Task a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
| |||||
type CancelResult (Task a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle | |||||
type WaitResult (Task a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle |
newtype StartToClose Source #
An Activity Execution must have either this timeout (Start-To-Close) or the Schedule-To-Close Timeout set. We recommend always setting this timeout; however, make sure that Start-To-Close Timeout is always set to be longer than the maximum possible time for the Activity Execution to complete. For long running Activity Executions, we recommend also using Activity Heartbeats and Heartbeat Timeouts.
Tip: We strongly recommend setting a Start-To-Close Timeout.
The Temporal Server doesn't detect failures when a Worker loses communication with the Server or crashes. Therefore, the Temporal Server relies on the Start-To-Close Timeout to force Activity retries.
Constructors
StartToClose Duration |
Instances
Data StartToClose Source # | |
Defined in Temporal.Common.TimeoutType Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> StartToClose -> c StartToClose # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c StartToClose # toConstr :: StartToClose -> Constr # dataTypeOf :: StartToClose -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c StartToClose) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c StartToClose) # gmapT :: (forall b. Data b => b -> b) -> StartToClose -> StartToClose # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> StartToClose -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> StartToClose -> r # gmapQ :: (forall d. Data d => d -> u) -> StartToClose -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> StartToClose -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> StartToClose -> m StartToClose # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> StartToClose -> m StartToClose # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> StartToClose -> m StartToClose # | |
Show StartToClose Source # | |
Defined in Temporal.Common.TimeoutType Methods showsPrec :: Int -> StartToClose -> ShowS # show :: StartToClose -> String # showList :: [StartToClose] -> ShowS # | |
Eq StartToClose Source # | |
Defined in Temporal.Common.TimeoutType | |
Ord StartToClose Source # | |
Defined in Temporal.Common.TimeoutType Methods compare :: StartToClose -> StartToClose -> Ordering # (<) :: StartToClose -> StartToClose -> Bool # (<=) :: StartToClose -> StartToClose -> Bool # (>) :: StartToClose -> StartToClose -> Bool # (>=) :: StartToClose -> StartToClose -> Bool # max :: StartToClose -> StartToClose -> StartToClose # min :: StartToClose -> StartToClose -> StartToClose # | |
StartActivityTimeoutOption StartToClose Source # | |
Defined in Temporal.Workflow.Types Methods toStartActivityTimeoutOption :: StartToClose -> ActivityTimeoutPolicy Source # | |
Lift StartToClose Source # | |
Defined in Temporal.Common.TimeoutType Methods lift :: Quote m => StartToClose -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => StartToClose -> Code m StartToClose # | |
StartActivityTimeoutOption (Either ScheduleToClose StartToClose) Source # | |
Defined in Temporal.Workflow.Types | |
StartActivityTimeoutOption (Either StartToClose ScheduleToClose) Source # | |
Defined in Temporal.Workflow.Types | |
StartActivityTimeoutOption (ScheduleToClose, StartToClose) Source # | |
Defined in Temporal.Workflow.Types Methods toStartActivityTimeoutOption :: (ScheduleToClose, StartToClose) -> ActivityTimeoutPolicy Source # | |
StartActivityTimeoutOption (StartToClose, ScheduleToClose) Source # | |
Defined in Temporal.Workflow.Types Methods toStartActivityTimeoutOption :: (StartToClose, ScheduleToClose) -> ActivityTimeoutPolicy Source # |
newtype ScheduleToClose Source #
A Schedule-To-Close Timeout is the maximum amount of time allowed for the overall Activity Execution, from when the first Activity Task is scheduled to when the last Activity Task, in the chain of Activity Tasks that make up the Activity Execution, reaches a Closed status.
An Activity Execution must have either this timeout (Schedule-To-Close) or Start-To-Close set. By default, an Activity Execution Retry Policy dictates that retries occur for up to 10 years. This timeout can be used to control the overall duration of an Activity Execution in the face of failures (repeated Activity Task Executions), without altering the Maximum Attempts field of the Retry Policy.
Constructors
ScheduleToClose Duration |
Instances
Data ScheduleToClose Source # | |
Defined in Temporal.Common.TimeoutType Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ScheduleToClose -> c ScheduleToClose # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ScheduleToClose # toConstr :: ScheduleToClose -> Constr # dataTypeOf :: ScheduleToClose -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ScheduleToClose) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ScheduleToClose) # gmapT :: (forall b. Data b => b -> b) -> ScheduleToClose -> ScheduleToClose # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ScheduleToClose -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ScheduleToClose -> r # gmapQ :: (forall d. Data d => d -> u) -> ScheduleToClose -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ScheduleToClose -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ScheduleToClose -> m ScheduleToClose # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ScheduleToClose -> m ScheduleToClose # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ScheduleToClose -> m ScheduleToClose # | |
Show ScheduleToClose Source # | |
Defined in Temporal.Common.TimeoutType Methods showsPrec :: Int -> ScheduleToClose -> ShowS # show :: ScheduleToClose -> String # showList :: [ScheduleToClose] -> ShowS # | |
Eq ScheduleToClose Source # | |
Defined in Temporal.Common.TimeoutType Methods (==) :: ScheduleToClose -> ScheduleToClose -> Bool # (/=) :: ScheduleToClose -> ScheduleToClose -> Bool # | |
Ord ScheduleToClose Source # | |
Defined in Temporal.Common.TimeoutType Methods compare :: ScheduleToClose -> ScheduleToClose -> Ordering # (<) :: ScheduleToClose -> ScheduleToClose -> Bool # (<=) :: ScheduleToClose -> ScheduleToClose -> Bool # (>) :: ScheduleToClose -> ScheduleToClose -> Bool # (>=) :: ScheduleToClose -> ScheduleToClose -> Bool # max :: ScheduleToClose -> ScheduleToClose -> ScheduleToClose # min :: ScheduleToClose -> ScheduleToClose -> ScheduleToClose # | |
StartActivityTimeoutOption ScheduleToClose Source # | |
Defined in Temporal.Workflow.Types | |
Lift ScheduleToClose Source # | |
Defined in Temporal.Common.TimeoutType Methods lift :: Quote m => ScheduleToClose -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ScheduleToClose -> Code m ScheduleToClose # | |
StartActivityTimeoutOption (Either ScheduleToClose StartToClose) Source # | |
Defined in Temporal.Workflow.Types | |
StartActivityTimeoutOption (Either StartToClose ScheduleToClose) Source # | |
Defined in Temporal.Workflow.Types | |
StartActivityTimeoutOption (ScheduleToClose, StartToClose) Source # | |
Defined in Temporal.Workflow.Types Methods toStartActivityTimeoutOption :: (ScheduleToClose, StartToClose) -> ActivityTimeoutPolicy Source # | |
StartActivityTimeoutOption (StartToClose, ScheduleToClose) Source # | |
Defined in Temporal.Workflow.Types Methods toStartActivityTimeoutOption :: (StartToClose, ScheduleToClose) -> ActivityTimeoutPolicy Source # |
The These
type represents values with two non-exclusive possibilities.
This can be useful to represent combinations of two values, where the
combination is defined if either input is. Algebraically, the type
represents These
A B(A + B + AB)
, which doesn't factor easily into
sums and products--a type like
is unclear and
awkward to use.Either
A (B, Maybe
A)
These
has straightforward instances of Functor
, Monad
, &c., and
behaves like a hybrid error/writer monad, as would be expected.
For zipping and unzipping of structures with These
values, see
Data.Align.
Instances
FromJSON2 These | Since: aeson-1.5.1.0 | ||||
Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (These a b) # liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [These a b] # liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (These a b) # | |||||
ToJSON2 These | Since: aeson-1.5.1.0 | ||||
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> These a b -> Value # liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [These a b] -> Value # liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> These a b -> Encoding # liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [These a b] -> Encoding # liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> These a b -> Bool # | |||||
Assoc These | Since: these-0.8 | ||||
Swap These | Since: these-0.8 | ||||
Defined in Data.These | |||||
Bifoldable These | |||||
Bifoldable1 These | Since: these-1.2 | ||||
Defined in Data.These | |||||
Bifunctor These | |||||
Bitraversable These | |||||
Defined in Data.These Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> These a b -> f (These c d) # | |||||
Eq2 These | Since: these-1.1.1 | ||||
Ord2 These | Since: these-1.1.1 | ||||
Defined in Data.These | |||||
Read2 These | Since: these-1.1.1 | ||||
Defined in Data.These Methods liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (These a b) # liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [These a b] # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (These a b) # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [These a b] # | |||||
Show2 These | Since: these-1.1.1 | ||||
NFData2 These | Since: these-1.1.1 | ||||
Defined in Data.These | |||||
Hashable2 These | Since: these-1.1.1 | ||||
Defined in Data.These | |||||
Generic1 (These a :: Type -> Type) | |||||
Defined in Data.These Associated Types
| |||||
FromJSON a => FromJSON1 (These a) | Since: aeson-1.5.1.0 | ||||
Defined in Data.Aeson.Types.FromJSON | |||||
ToJSON a => ToJSON1 (These a) | Since: aeson-1.5.1.0 | ||||
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> These a a0 -> Value # liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [These a a0] -> Value # liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> These a a0 -> Encoding # liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [These a a0] -> Encoding # liftOmitField :: (a0 -> Bool) -> These a a0 -> Bool # | |||||
Eq a => Eq1 (These a) | Since: these-1.1.1 | ||||
Ord a => Ord1 (These a) | Since: these-1.1.1 | ||||
Defined in Data.These | |||||
Read a => Read1 (These a) | Since: these-1.1.1 | ||||
Defined in Data.These Methods liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (These a a0) # liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [These a a0] # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (These a a0) # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [These a a0] # | |||||
Show a => Show1 (These a) | Since: these-1.1.1 | ||||
NFData a => NFData1 (These a) | Since: these-1.1.1 | ||||
Defined in Data.These | |||||
Semigroup a => Applicative (These a) | |||||
Functor (These a) | |||||
Semigroup a => Monad (These a) | |||||
Foldable (These a) | |||||
Defined in Data.These Methods fold :: Monoid m => These a m -> m # foldMap :: Monoid m => (a0 -> m) -> These a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> These a a0 -> m # foldr :: (a0 -> b -> b) -> b -> These a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> These a a0 -> b # foldl :: (b -> a0 -> b) -> b -> These a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> These a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 # toList :: These a a0 -> [a0] # elem :: Eq a0 => a0 -> These a a0 -> Bool # maximum :: Ord a0 => These a a0 -> a0 # minimum :: Ord a0 => These a a0 -> a0 # | |||||
Traversable (These a) | |||||
Hashable a => Hashable1 (These a) | Since: these-1.1.1 | ||||
Defined in Data.These | |||||
(FromJSON a, FromJSON b) => FromJSON (These a b) | Since: aeson-1.5.1.0 | ||||
Defined in Data.Aeson.Types.FromJSON | |||||
(ToJSON a, ToJSON b) => ToJSON (These a b) | Since: aeson-1.5.1.0 | ||||
(Binary a, Binary b) => Binary (These a b) | Since: these-0.7.1 | ||||
(NFData a, NFData b) => NFData (These a b) | Since: these-0.7.1 | ||||
Defined in Data.These | |||||
(Semigroup a, Semigroup b) => Semigroup (These a b) | |||||
(Data a, Data b) => Data (These a b) | |||||
Defined in Data.These Methods gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> These a b -> c (These a b) # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (These a b) # toConstr :: These a b -> Constr # dataTypeOf :: These a b -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (These a b)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (These a b)) # gmapT :: (forall b0. Data b0 => b0 -> b0) -> These a b -> These a b # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> These a b -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> These a b -> r # gmapQ :: (forall d. Data d => d -> u) -> These a b -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> These a b -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> These a b -> m (These a b) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> These a b -> m (These a b) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> These a b -> m (These a b) # | |||||
Generic (These a b) | |||||
Defined in Data.These Associated Types
| |||||
(Read a, Read b) => Read (These a b) | |||||
(Show a, Show b) => Show (These a b) | |||||
(Eq a, Eq b) => Eq (These a b) | |||||
(Ord a, Ord b) => Ord (These a b) | |||||
(Hashable a, Hashable b) => Hashable (These a b) | |||||
Defined in Data.These | |||||
type Rep1 (These a :: Type -> Type) | |||||
Defined in Data.These type Rep1 (These a :: Type -> Type) = D1 ('MetaData "These" "Data.These" "these-1.2.1-HG2k15Ljfw0IFSMg5sFm1e" 'False) (C1 ('MetaCons "This" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: (C1 ('MetaCons "That" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1) :+: C1 ('MetaCons "These" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))) | |||||
type Rep (These a b) | |||||
Defined in Data.These type Rep (These a b) = D1 ('MetaData "These" "Data.These" "these-1.2.1-HG2k15Ljfw0IFSMg5sFm1e" 'False) (C1 ('MetaCons "This" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: (C1 ('MetaCons "That" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b)) :+: C1 ('MetaCons "These" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b)))) |
Workflow monad operations
Activity operations
An Activity is an IO-based function that executes a single, well-defined action (either short or long running), such as calling another service, transcoding a media file, or sending an email message. Activity code can be non-deterministic.
We recommend that it be idempotent.
Workflow code orchestrates the execution of Activities, persisting the results. If an Activity Function Execution fails, any future execution starts from initial state (except Heartbeats).
Activity Functions are executed by Worker Processes. When the Activity Function returns, the Worker sends the results back to the Temporal Cluster as part of the ActivityTaskCompleted Event. The Event is added to the Workflow Execution's Event History.
class ActivityRef f where Source #
Methods
activityRef :: f -> KnownActivity (ActivityArgs f) (ActivityResult f) Source #
Instances
(Fn f, ActivityFn f) => ActivityRef (ActivityImpl f) Source # | |||||||||
Defined in Temporal.TH.Classes Associated Types
Methods activityRef :: ActivityImpl f -> KnownActivity (ActivityArgs (ActivityImpl f)) (ActivityResult (ActivityImpl f)) Source # | |||||||||
(TypeError DirectActivityReferenceMsg :: Constraint) => ActivityRef (Activity env a) Source # | |||||||||
Defined in Temporal.Activity.Definition Associated Types
Methods activityRef :: Activity env a -> KnownActivity (ActivityArgs (Activity env a)) (ActivityResult (Activity env a)) Source # | |||||||||
VarArgs args => ActivityRef (KnownActivity args result) Source # | |||||||||
Defined in Temporal.Activity.Definition Associated Types
Methods activityRef :: KnownActivity args result -> KnownActivity (ActivityArgs (KnownActivity args result)) (ActivityResult (KnownActivity args result)) Source # | |||||||||
ActivityRef (ProvidedActivity env f) Source # | |||||||||
Defined in Temporal.Activity.Definition Associated Types
Methods activityRef :: ProvidedActivity env f -> KnownActivity (ActivityArgs (ProvidedActivity env f)) (ActivityResult (ProvidedActivity env f)) Source # | |||||||||
(f ~ (ArgsOf f :->: Activity env (ResultOf (Activity env) f)), TypeError DirectActivityReferenceMsg :: Constraint) => ActivityRef (a -> f) Source # | |||||||||
Defined in Temporal.Activity.Definition Associated Types
Methods activityRef :: (a -> f) -> KnownActivity (ActivityArgs (a -> f)) (ActivityResult (a -> f)) Source # |
data KnownActivity (args :: [Type]) result Source #
Constructors
FunctionSupportsCodec codec args result => KnownActivity | |
Fields
|
Instances
VarArgs args => UseAsInWorkflowProxy ProxyAsync (KnownActivity args res) Source # | |||||||||
Defined in Temporal.Bundle Methods useAsInWorkflowProxy :: ProxyAsync -> KnownActivity args res -> (RefStartOptions @@ KnownActivity args res) -> InWorkflowProxies ProxyAsync @@ KnownActivity args res Source # | |||||||||
VarArgs args => UseAsInWorkflowProxy ProxySync (KnownActivity args res) Source # | |||||||||
Defined in Temporal.Bundle Methods useAsInWorkflowProxy :: ProxySync -> KnownActivity args res -> (RefStartOptions @@ KnownActivity args res) -> InWorkflowProxies ProxySync @@ KnownActivity args res Source # | |||||||||
VarArgs args => ActivityRef (KnownActivity args result) Source # | |||||||||
Defined in Temporal.Activity.Definition Associated Types
Methods activityRef :: KnownActivity args result -> KnownActivity (ActivityArgs (KnownActivity args result)) (ActivityResult (KnownActivity args result)) Source # | |||||||||
FieldToStartOptionDefaults (KnownActivity args res) Source # | |||||||||
Defined in Temporal.Bundle Methods refStartOptionsDefaults :: Proxy (KnownActivity args res) -> StartActivityOptions -> StartChildWorkflowOptions -> RefStartOptionsType (KnownActivity args res) Source # | |||||||||
type Eval (InWorkflowProxies ProxyAsync (KnownActivity args res) :: Type -> Type) Source # | |||||||||
Defined in Temporal.Bundle type Eval (InWorkflowProxies ProxyAsync (KnownActivity args res) :: Type -> Type) = args :->: Workflow (Task res) | |||||||||
type Eval (InWorkflowProxies ProxySync (KnownActivity args res) :: Type -> Type) Source # | |||||||||
Defined in Temporal.Bundle type Eval (InWorkflowProxies ProxySync (KnownActivity args res) :: Type -> Type) = args :->: Workflow res | |||||||||
type ActivityArgs (KnownActivity args result) Source # | |||||||||
Defined in Temporal.Activity.Definition | |||||||||
type ActivityResult (KnownActivity args result) Source # | |||||||||
Defined in Temporal.Activity.Definition |
data StartActivityOptions Source #
Constructors
StartActivityOptions | |
Fields
|
Instances
Show StartActivityOptions Source # | |
Defined in Temporal.Workflow.Types Methods showsPrec :: Int -> StartActivityOptions -> ShowS # show :: StartActivityOptions -> String # showList :: [StartActivityOptions] -> ShowS # | |
Lift StartActivityOptions Source # | |
Defined in Temporal.Workflow.Types Methods lift :: Quote m => StartActivityOptions -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => StartActivityOptions -> Code m StartActivityOptions # |
data ActivityCancellationType Source #
Defines how the workflow will wait (or not) for cancellation of the activity to be confirmed.
Constructors
ActivityCancellationTryCancel | Initiate a cancellation request and immediately report cancellation to the workflow. |
ActivityCancellationWaitCancellationCompleted | Wait for activity cancellation completion. Note that activity must heartbeat to receive a cancellation notification. This can block the cancellation for a long time if activity doesn't heartbeat or chooses to ignore the cancellation request. |
ActivityCancellationAbandon | Do not request cancellation of the activity and immediately report cancellation to the workflow |
Instances
Data ActivityCancellationType Source # | |
Defined in Temporal.Workflow.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ActivityCancellationType -> c ActivityCancellationType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ActivityCancellationType # toConstr :: ActivityCancellationType -> Constr # dataTypeOf :: ActivityCancellationType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ActivityCancellationType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ActivityCancellationType) # gmapT :: (forall b. Data b => b -> b) -> ActivityCancellationType -> ActivityCancellationType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ActivityCancellationType -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ActivityCancellationType -> r # gmapQ :: (forall d. Data d => d -> u) -> ActivityCancellationType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ActivityCancellationType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ActivityCancellationType -> m ActivityCancellationType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ActivityCancellationType -> m ActivityCancellationType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ActivityCancellationType -> m ActivityCancellationType # | |
Show ActivityCancellationType Source # | |
Defined in Temporal.Workflow.Types Methods showsPrec :: Int -> ActivityCancellationType -> ShowS # show :: ActivityCancellationType -> String # showList :: [ActivityCancellationType] -> ShowS # | |
Eq ActivityCancellationType Source # | |
Defined in Temporal.Workflow.Types Methods (==) :: ActivityCancellationType -> ActivityCancellationType -> Bool # (/=) :: ActivityCancellationType -> ActivityCancellationType -> Bool # | |
Lift ActivityCancellationType Source # | |
Defined in Temporal.Workflow.Types Methods lift :: Quote m => ActivityCancellationType -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ActivityCancellationType -> Code m ActivityCancellationType # |
data ActivityTimeoutPolicy Source #
Constructors
StartToCloseTimeout !Duration | |
ScheduleToCloseTimeout !Duration | |
StartToCloseAndScheduleToCloseTimeout !Duration !Duration |
Instances
Data ActivityTimeoutPolicy Source # | |
Defined in Temporal.Workflow.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ActivityTimeoutPolicy -> c ActivityTimeoutPolicy # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ActivityTimeoutPolicy # toConstr :: ActivityTimeoutPolicy -> Constr # dataTypeOf :: ActivityTimeoutPolicy -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ActivityTimeoutPolicy) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ActivityTimeoutPolicy) # gmapT :: (forall b. Data b => b -> b) -> ActivityTimeoutPolicy -> ActivityTimeoutPolicy # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ActivityTimeoutPolicy -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ActivityTimeoutPolicy -> r # gmapQ :: (forall d. Data d => d -> u) -> ActivityTimeoutPolicy -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ActivityTimeoutPolicy -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ActivityTimeoutPolicy -> m ActivityTimeoutPolicy # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ActivityTimeoutPolicy -> m ActivityTimeoutPolicy # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ActivityTimeoutPolicy -> m ActivityTimeoutPolicy # | |
Show ActivityTimeoutPolicy Source # | |
Defined in Temporal.Workflow.Types Methods showsPrec :: Int -> ActivityTimeoutPolicy -> ShowS # show :: ActivityTimeoutPolicy -> String # showList :: [ActivityTimeoutPolicy] -> ShowS # | |
Eq ActivityTimeoutPolicy Source # | |
Defined in Temporal.Workflow.Types Methods (==) :: ActivityTimeoutPolicy -> ActivityTimeoutPolicy -> Bool # (/=) :: ActivityTimeoutPolicy -> ActivityTimeoutPolicy -> Bool # | |
StartActivityTimeoutOption ActivityTimeoutPolicy Source # | |
Defined in Temporal.Workflow.Types | |
Lift ActivityTimeoutPolicy Source # | |
Defined in Temporal.Workflow.Types Methods lift :: Quote m => ActivityTimeoutPolicy -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ActivityTimeoutPolicy -> Code m ActivityTimeoutPolicy # |
class StartActivityTimeoutOption a where Source #
Methods
toStartActivityTimeoutOption :: a -> ActivityTimeoutPolicy Source #
Instances
StartActivityTimeoutOption ScheduleToClose Source # | |
Defined in Temporal.Workflow.Types | |
StartActivityTimeoutOption StartToClose Source # | |
Defined in Temporal.Workflow.Types Methods toStartActivityTimeoutOption :: StartToClose -> ActivityTimeoutPolicy Source # | |
StartActivityTimeoutOption ActivityTimeoutPolicy Source # | |
Defined in Temporal.Workflow.Types | |
StartActivityTimeoutOption (Either ScheduleToClose StartToClose) Source # | |
Defined in Temporal.Workflow.Types | |
StartActivityTimeoutOption (Either StartToClose ScheduleToClose) Source # | |
Defined in Temporal.Workflow.Types | |
StartActivityTimeoutOption (ScheduleToClose, StartToClose) Source # | |
Defined in Temporal.Workflow.Types Methods toStartActivityTimeoutOption :: (ScheduleToClose, StartToClose) -> ActivityTimeoutPolicy Source # | |
StartActivityTimeoutOption (StartToClose, ScheduleToClose) Source # | |
Defined in Temporal.Workflow.Types Methods toStartActivityTimeoutOption :: (StartToClose, ScheduleToClose) -> ActivityTimeoutPolicy Source # |
defaultStartActivityOptions :: StartActivityTimeoutOption timeout => timeout -> StartActivityOptions Source #
startActivity :: (RequireCallStack, ActivityRef activity) => activity -> StartActivityOptions -> ActivityArgs activity :->: Workflow (Task (ActivityResult activity)) Source #
executeActivity :: (RequireCallStack, ActivityRef activity) => activity -> StartActivityOptions -> ActivityArgs activity :->: Workflow (ActivityResult activity) Source #
data StartLocalActivityOptions Source #
Constructors
StartLocalActivityOptions | |
Fields
|
startLocalActivity :: (RequireCallStack, ActivityRef act) => act -> StartLocalActivityOptions -> ActivityArgs act :->: Workflow (Task (ActivityResult act)) Source #
Child workflow operations
A Child Workflow Execution is a Workflow Execution that is spawned from within another Workflow.
A Workflow Execution can be both a Parent and a Child Workflow Execution because any Workflow can spawn another Workflow.
data StartChildWorkflowOptions Source #
Constructors
StartChildWorkflowOptions | |
Fields
|
Instances
Show StartChildWorkflowOptions Source # | |
Defined in Temporal.Workflow.Types Methods showsPrec :: Int -> StartChildWorkflowOptions -> ShowS # show :: StartChildWorkflowOptions -> String # showList :: [StartChildWorkflowOptions] -> ShowS # | |
Lift StartChildWorkflowOptions Source # | |
Defined in Temporal.Workflow.Types Methods lift :: Quote m => StartChildWorkflowOptions -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => StartChildWorkflowOptions -> Code m StartChildWorkflowOptions # |
class WorkflowRef f where Source #
Methods
workflowRef :: f -> KnownWorkflow (WorkflowArgs f) (WorkflowResult f) Source #
Instances
(Fn f, WorkflowFn f) => WorkflowRef (WorkflowImpl f) Source # | |||||||||
Defined in Temporal.TH.Classes Associated Types
Methods workflowRef :: WorkflowImpl f -> KnownWorkflow (WorkflowArgs (WorkflowImpl f)) (WorkflowResult (WorkflowImpl f)) Source # | |||||||||
VarArgs (ArgsOf f) => WorkflowRef (ProvidedWorkflow f) Source # | |||||||||
Defined in Temporal.Workflow.Definition Associated Types
Methods workflowRef :: ProvidedWorkflow f -> KnownWorkflow (WorkflowArgs (ProvidedWorkflow f)) (WorkflowResult (ProvidedWorkflow f)) Source # | |||||||||
WorkflowRef (KnownWorkflow args result) Source # | |||||||||
Defined in Temporal.Workflow.Definition Associated Types
Methods workflowRef :: KnownWorkflow args result -> KnownWorkflow (WorkflowArgs (KnownWorkflow args result)) (WorkflowResult (KnownWorkflow args result)) Source # |
startChildWorkflow :: (RequireCallStack, WorkflowRef wf) => wf -> StartChildWorkflowOptions -> WorkflowArgs wf :->: Workflow (ChildWorkflowHandle (WorkflowResult wf)) Source #
Start a child Workflow execution
Returns a client-side handle that implements a child Workflow interface.
By default, a child will be scheduled on the same task queue as its parent.
A child Workflow handle supports awaiting completion, signaling and cancellation via the returned handle.
In order to query the child, use a WorkflowClient from an Activity.
executeChildWorkflow :: (RequireCallStack, WorkflowRef wf) => wf -> StartChildWorkflowOptions -> WorkflowArgs wf :->: Workflow (WorkflowResult wf) Source #
data ChildWorkflowHandle result Source #
A client side handle to a single child Workflow instance.
It can be used to signal, wait for completion, and cancel the workflow.
Instances
Functor ChildWorkflowHandle Source # | |||||
Defined in Temporal.Workflow.Internal.Monad Methods fmap :: (a -> b) -> ChildWorkflowHandle a -> ChildWorkflowHandle b # (<$) :: a -> ChildWorkflowHandle b -> ChildWorkflowHandle a # | |||||
WorkflowHandle ChildWorkflowHandle Source # | |||||
Defined in Temporal.Workflow Methods signal :: (SignalRef ref, RequireCallStack) => ChildWorkflowHandle result -> ref -> SignalArgs ref :->: Workflow (Task ()) Source # | |||||
Cancel (ChildWorkflowHandle a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
Methods cancel :: ChildWorkflowHandle a -> CancelResult (ChildWorkflowHandle a) Source # | |||||
Wait (ChildWorkflowHandle a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
Methods wait :: ChildWorkflowHandle a -> WaitResult (ChildWorkflowHandle a) Source # | |||||
type CancelResult (ChildWorkflowHandle a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle | |||||
type WaitResult (ChildWorkflowHandle a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle |
Some tasks in a Workflow return a handle that can be used to wait for the task to complete.
This class provides a common interface for waiting on these handles.
Associated Types
type WaitResult h Source #
Instances
Wait Timer Source # | |||||
Defined in Temporal.Workflow Associated Types
| |||||
Wait (ChildWorkflowHandle a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
Methods wait :: ChildWorkflowHandle a -> WaitResult (ChildWorkflowHandle a) Source # | |||||
Wait (Task a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
|
Some tasks in a Workflow return a handle that can be used to cancel a task.
This class provides a common interface for performing cancellation on these handles.
Associated Types
type CancelResult h Source #
Methods
cancel :: h -> CancelResult h Source #
Signal to Temporal that a handle representing an async action should be cancelled.
Instances
Cancel Timer Source # | |||||
Defined in Temporal.Workflow Associated Types
| |||||
Cancel (ChildWorkflowHandle a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
Methods cancel :: ChildWorkflowHandle a -> CancelResult (ChildWorkflowHandle a) Source # | |||||
Cancel (ExternalWorkflowHandle a) Source # | Returns an action that can be used to await cancellation of an external workflow. Throws | ||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
Methods cancel :: ExternalWorkflowHandle a -> CancelResult (ExternalWorkflowHandle a) Source # | |||||
Cancel (Task a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
|
class WorkflowHandle (h :: k -> Type) where Source #
A client side handle to a single Workflow instance. It can be used to signal a workflow execution.
Given the following Workflow definition:
Methods
signal :: forall ref (result :: k). (SignalRef ref, RequireCallStack) => h result -> ref -> SignalArgs ref :->: Workflow (Task ()) Source #
Signal a running Workflow.
Instances
WorkflowHandle ChildWorkflowHandle Source # | |
Defined in Temporal.Workflow Methods signal :: (SignalRef ref, RequireCallStack) => ChildWorkflowHandle result -> ref -> SignalArgs ref :->: Workflow (Task ()) Source # | |
WorkflowHandle ExternalWorkflowHandle Source # | |
Defined in Temporal.Workflow Methods signal :: (SignalRef ref, RequireCallStack) => ExternalWorkflowHandle result -> ref -> SignalArgs ref :->: Workflow (Task ()) Source # |
waitChildWorkflowResult :: RequireCallStack => ChildWorkflowHandle result -> Workflow result Source #
waitChildWorkflowStart :: RequireCallStack => ChildWorkflowHandle result -> Workflow () Source #
cancelChildWorkflowExecution :: RequireCallStack => ChildWorkflowHandle result -> Workflow () Source #
data ExternalWorkflowHandle result Source #
Handle representing an external Workflow Execution.
This handle can only be cancelled and signalled.
To call other methods, like query and result, use a WorkflowClient.getHandle inside an Activity.
Instances
WorkflowHandle ExternalWorkflowHandle Source # | |||||
Defined in Temporal.Workflow Methods signal :: (SignalRef ref, RequireCallStack) => ExternalWorkflowHandle result -> ref -> SignalArgs ref :->: Workflow (Task ()) Source # | |||||
Cancel (ExternalWorkflowHandle a) Source # | Returns an action that can be used to await cancellation of an external workflow. Throws | ||||
Defined in Temporal.Workflow.Unsafe.Handle Associated Types
Methods cancel :: ExternalWorkflowHandle a -> CancelResult (ExternalWorkflowHandle a) Source # | |||||
type CancelResult (ExternalWorkflowHandle a) Source # | |||||
Defined in Temporal.Workflow.Unsafe.Handle |
getExternalWorkflowHandle :: RequireCallStack => WorkflowId -> Maybe RunId -> Workflow (ExternalWorkflowHandle result) Source #
Returns a client-side handle that can be used to signal and cancel an existing Workflow execution. It takes a Workflow ID and optional run ID.
Constructors
Info | |
Fields
|
data RetryPolicy Source #
A Retry Policy is a collection of attributes that instructs the Temporal Server how to retry a failure of a Workflow Execution or an Activity Task Execution.
Constructors
RetryPolicy | |
Fields
|
Instances
FromJSON RetryPolicy Source # | |||||
Defined in Temporal.Common | |||||
ToJSON RetryPolicy Source # | |||||
Defined in Temporal.Common Methods toJSON :: RetryPolicy -> Value # toEncoding :: RetryPolicy -> Encoding # toJSONList :: [RetryPolicy] -> Value # toEncodingList :: [RetryPolicy] -> Encoding # omitField :: RetryPolicy -> Bool # | |||||
Data RetryPolicy Source # | |||||
Defined in Temporal.Common Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RetryPolicy -> c RetryPolicy # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RetryPolicy # toConstr :: RetryPolicy -> Constr # dataTypeOf :: RetryPolicy -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RetryPolicy) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RetryPolicy) # gmapT :: (forall b. Data b => b -> b) -> RetryPolicy -> RetryPolicy # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RetryPolicy -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RetryPolicy -> r # gmapQ :: (forall d. Data d => d -> u) -> RetryPolicy -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> RetryPolicy -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> RetryPolicy -> m RetryPolicy # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RetryPolicy -> m RetryPolicy # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RetryPolicy -> m RetryPolicy # | |||||
Generic RetryPolicy Source # | |||||
Defined in Temporal.Common Associated Types
| |||||
Show RetryPolicy Source # | |||||
Defined in Temporal.Common Methods showsPrec :: Int -> RetryPolicy -> ShowS # show :: RetryPolicy -> String # showList :: [RetryPolicy] -> ShowS # | |||||
Eq RetryPolicy Source # | |||||
Defined in Temporal.Common | |||||
Lift RetryPolicy Source # | |||||
Defined in Temporal.Common Methods lift :: Quote m => RetryPolicy -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => RetryPolicy -> Code m RetryPolicy # | |||||
type Rep RetryPolicy Source # | |||||
Defined in Temporal.Common type Rep RetryPolicy = D1 ('MetaData "RetryPolicy" "Temporal.Common" "temporal-sdk-0.0.1.0-inplace" 'False) (C1 ('MetaCons "RetryPolicy" 'PrefixI 'True) ((S1 ('MetaSel ('Just "initialInterval") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Duration) :*: S1 ('MetaSel ('Just "backoffCoefficient") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :*: (S1 ('MetaSel ('Just "maximumInterval") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Duration)) :*: (S1 ('MetaSel ('Just "maximumAttempts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int32) :*: S1 ('MetaSel ('Just "nonRetryableErrorTypes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector Text)))))) |
data ParentInfo Source #
Constructors
ParentInfo | |
Fields |
Instances
Generic ParentInfo Source # | |||||
Defined in Temporal.Common Associated Types
| |||||
Show ParentInfo Source # | |||||
Defined in Temporal.Common Methods showsPrec :: Int -> ParentInfo -> ShowS # show :: ParentInfo -> String # showList :: [ParentInfo] -> ShowS # | |||||
Eq ParentInfo Source # | |||||
Defined in Temporal.Common | |||||
type Rep ParentInfo Source # | |||||
Defined in Temporal.Common type Rep ParentInfo = D1 ('MetaData "ParentInfo" "Temporal.Common" "temporal-sdk-0.0.1.0-inplace" 'False) (C1 ('MetaCons "ParentInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "parentNamespace") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Namespace) :*: (S1 ('MetaSel ('Just "parentRunId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RunId) :*: S1 ('MetaSel ('Just "parentWorkflowId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WorkflowId)))) |
Workflow metadata
upsertSearchAttributes :: RequireCallStack => Map SearchAttributeKey SearchAttributeType -> Workflow () Source #
Updates this Workflow's Search Attributes by merging the provided searchAttributes with the existing Search Attributes
Using this function will overwrite any existing Search Attributes with the same key.
Versioning workflows
Versioning (known as "patching" in the Haskell library) lets you update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows.
You may need to patch if:
- You want to change the remaining logic of a Workflow while it is still running
- If your new logic can result in a different execution path
patched :: RequireCallStack => PatchId -> Workflow Bool Source #
Patch or upgrade workflow code by checking or stating that this workflow has a certain patch.
See official Temporal docs page for info.
If the workflow is replaying an existing history, then this function returns true if that history was produced by a worker which also had a patched call with the same patchId.
If the history was produced by a worker without such a call, then it will return false.
If the workflow is not currently replaying, then this call always returns true.
Your workflow code should run the "new" code if this returns true, if it returns false, you should run the "old" code. By doing this, you can maintain determinism.
deprecatePatch :: RequireCallStack => PatchId -> Workflow () Source #
Indicate that a patch is being phased out.
See official Temporal docs page for info.
Workflows with this call may be deployed alongside workflows with a patched call, but they must not be deployed while any workers still exist running old code without a patched call, or any runs with histories produced by such workers exist. If either kind of worker encounters a history produced by the other, their behavior is undefined.
Once all live workflow runs have been produced by workers with this call, you can deploy workers which are free of either kind of patch call for this ID. Workers with and without this call may coexist, as long as they are both running the "new" code.
Concurrency within Workflows
race :: RequireCallStack => Workflow a -> Workflow b -> Workflow (Either a b) Source #
This function takes two Workflow computations as input, and returns the output of whichever computation finished first. The evaluation of the remaining computation is discontinued.
Note: This function doesn't have a way to explicitly signal to the incomplete other computation that it will no longer be evaluated, so you should be careful about ensuring that incomplete computations are not problematic for your problem domain.
race_ :: RequireCallStack => Workflow a -> Workflow b -> Workflow () Source #
Run two Workflow actions concurrently, and return the first to finish.
Unlike 'Control.Concurrent.Async.race, this function doesn't explicitly cancel the other computation. If you want to cancel the other computation, you should return sufficient context to do so manually
concurrently :: Workflow a -> Workflow b -> Workflow (a, b) Source #
Run two Workflow actions concurrently, and return both results. If either action throws an exception at any time, the other action will run to completion as long as the exception is caught and handled.
concurrently_ :: Workflow a -> Workflow b -> Workflow () Source #
Like concurrently
, but ignore the result values.
mapConcurrently :: Traversable t => (a -> Workflow b) -> t a -> Workflow (t b) Source #
Map an effect-performing function over over any Traversable
data type, performing each action concurrently,
returning the original data structure with the arguments replaced with the results.
This is actually a bit of a misnomer, since it's really traverseConcurrently
, but this is copied to mimic the async
package's naming
to slightly ease adoption.
mapConcurrently_ :: Foldable t => (a -> Workflow b) -> t a -> Workflow () Source #
Alias for traverseConcurrently_
replicateConcurrently :: Int -> Workflow a -> Workflow [a] Source #
Perform the action in the given number of evaluation branches.
replicateConcurrently_ :: Int -> Workflow a -> Workflow () Source #
Perform the action in the given number of evaluation branches, discarding the results
forConcurrently :: Traversable t => t a -> (a -> Workflow b) -> Workflow (t b) Source #
traverseConcurrently
with the arguments flipped.
forConcurrently_ :: Foldable t => t a -> (a -> Workflow b) -> Workflow () Source #
traverseConcurrently_
with the arguments flipped.
traverseConcurrently :: Traversable t => (a -> Workflow b) -> t a -> Workflow (t b) Source #
Evaluate the action in the given number of evaluation branches, accumulating the results
sequenceConcurrently :: Traversable t => t (Workflow a) -> Workflow (t a) Source #
Evaluate each Workflow action in the structure concurrently, and collect the results.
sequenceConcurrently_ :: Foldable t => t (Workflow a) -> Workflow () Source #
Evaluate each Workflow action in the structure concurrently, and ignore the results.
newtype ConcurrentWorkflow a Source #
A value of type ConcurrentWorkflow
a is a Workflow
operation that can be composed with other ConcurrentWorkflow values, using the Applicative and Alternative instances.
ConcurrentWorkflow
effectively operates as a computation DAG. It's evaluated by exploring the expression across all of the branches of computation until every branch becomes blocked
waiting on results from Temporal.
Once that happens, it submits all commands that it has accumulated to the Temporal orchestrator and waits to be reactivated with commands from the orchestrator that unblock
computation on one or more branches. This is repeated until the computation completes. When Applicative
is used, that means that each computation branch doesn't depend on the
result of the others, so they can all explore as far as possible and get blocked. If we use Monad
, then that means that the result of the previous computation has to become
unblocked in order to provide the result to the subsequent computation.
Constructors
ConcurrentWorkflow | |
Fields |
Instances
MonadCatch ConcurrentWorkflow Source # | |
Defined in Temporal.Workflow Methods catch :: (HasCallStack, Exception e) => ConcurrentWorkflow a -> (e -> ConcurrentWorkflow a) -> ConcurrentWorkflow a # | |
MonadThrow ConcurrentWorkflow Source # | |
Defined in Temporal.Workflow Methods throwM :: (HasCallStack, Exception e) => e -> ConcurrentWorkflow a # | |
Alternative ConcurrentWorkflow Source # | |
Defined in Temporal.Workflow Methods empty :: ConcurrentWorkflow a # (<|>) :: ConcurrentWorkflow a -> ConcurrentWorkflow a -> ConcurrentWorkflow a # some :: ConcurrentWorkflow a -> ConcurrentWorkflow [a] # many :: ConcurrentWorkflow a -> ConcurrentWorkflow [a] # | |
Applicative ConcurrentWorkflow Source # | |
Defined in Temporal.Workflow Methods pure :: a -> ConcurrentWorkflow a # (<*>) :: ConcurrentWorkflow (a -> b) -> ConcurrentWorkflow a -> ConcurrentWorkflow b # liftA2 :: (a -> b -> c) -> ConcurrentWorkflow a -> ConcurrentWorkflow b -> ConcurrentWorkflow c # (*>) :: ConcurrentWorkflow a -> ConcurrentWorkflow b -> ConcurrentWorkflow b # (<*) :: ConcurrentWorkflow a -> ConcurrentWorkflow b -> ConcurrentWorkflow a # | |
Functor ConcurrentWorkflow Source # | |
Defined in Temporal.Workflow Methods fmap :: (a -> b) -> ConcurrentWorkflow a -> ConcurrentWorkflow b # (<$) :: a -> ConcurrentWorkflow b -> ConcurrentWorkflow a # | |
Monad ConcurrentWorkflow Source # | |
Defined in Temporal.Workflow Methods (>>=) :: ConcurrentWorkflow a -> (a -> ConcurrentWorkflow b) -> ConcurrentWorkflow b # (>>) :: ConcurrentWorkflow a -> ConcurrentWorkflow b -> ConcurrentWorkflow b # return :: a -> ConcurrentWorkflow a # | |
MonadLogger ConcurrentWorkflow Source # | |
Defined in Temporal.Workflow Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ConcurrentWorkflow () # | |
Monoid a => Monoid (ConcurrentWorkflow a) Source # | |
Defined in Temporal.Workflow Methods mempty :: ConcurrentWorkflow a # mappend :: ConcurrentWorkflow a -> ConcurrentWorkflow a -> ConcurrentWorkflow a # mconcat :: [ConcurrentWorkflow a] -> ConcurrentWorkflow a # | |
Semigroup a => Semigroup (ConcurrentWorkflow a) Source # | |
Defined in Temporal.Workflow Methods (<>) :: ConcurrentWorkflow a -> ConcurrentWorkflow a -> ConcurrentWorkflow a # sconcat :: NonEmpty (ConcurrentWorkflow a) -> ConcurrentWorkflow a # stimes :: Integral b => b -> ConcurrentWorkflow a -> ConcurrentWorkflow a # |
biselect :: RequireCallStack => Workflow (Either a b) -> Workflow (Either a c) -> Workflow (Either a (b, c)) Source #
biselectOpt :: RequireCallStack => (l -> Either a b) -> (r -> Either a c) -> (a -> t) -> ((b, c) -> t) -> Workflow l -> Workflow r -> Workflow t Source #
The biselectOpt
function combines two workflows and applies optimized selection logic.
This function is inspired by the Haxl
library's Haxl.Core.Parallel functions. It takes two workflows
and combines them, applying discrimination functions to their results to determine the final outcome.
The function works as follows:
- It explores both workflows concurrently.
- If the left workflow completes first:
- If the first argument returns
Left
, the result is immediately returned using the third function. - If the first argument returnsRight
, it waits for the right workflow to complete. - If the right workflow completes first:
- If the second argument returns
Left
, the result is immediately returned using the third function. - If the second argument returnsRight
, it waits for the left workflow to complete. - If both workflows complete:
- The results are combined using the fourth function if both discriminators return
Right
. - If either workflow throws an exception, the exception is propagated.
- If either workflow is blocked, the function manages the blocking and resumption of computation.
This function optimizes the execution by short-circuiting when possible and managing concurrency efficiently. Be cautious when using this function, as exceptions and evaluation order can be unpredictable depending on the discriminator functions provided.
Interacting with running Workflows
Queries
A Query is a synchronous operation that is used to get the state of a Workflow Execution. The state of a running Workflow Execution is constantly changing. You can use Queries to expose the internal Workflow Execution state to the external world. Queries are available for running or completed Workflows Executions only if the Worker is up and listening on the Task Queue.
Queries are strongly consistent and are guaranteed to return the most recent state. This means that the data reflects the state of all confirmed Events that came in before the Query was sent. An Event is considered confirmed if the call creating the Event returned success. Events that are created while the Query is outstanding may or may not be reflected in the Workflow state the Query result is based on.
A Query can carry arguments to specify the data it is requesting. And each Workflow can expose data to multiple types of Queries.
A Query cannot mutate the state of the Workflow Execution— that is, Queries are read-only and cannot contain any blocking code. This means, for example, that Query handling logic cannot schedule Activity Executions.
class QueryRef query where Source #
Methods
queryRef :: query -> KnownQuery (QueryArgs query) (QueryResult query) Source #
Instances
QueryRef (KnownQuery args result) Source # | |||||||||
Defined in Temporal.Workflow.Query Associated Types
Methods queryRef :: KnownQuery args result -> KnownQuery (QueryArgs (KnownQuery args result)) (QueryResult (KnownQuery args result)) Source # |
The Query monad is a very constrained version of the Workflow monad. It can only read state variables and return values. It is used to define query handlers.
data KnownQuery (args :: [Type]) result Source #
Queries are sent from a Temporal Client to a Workflow Execution. The API call is synchronous. The Query is identified at both ends by a Query name. The Workflow must have a Query handler that is developed to handle that Query and provide data that represents the state of the Workflow Execution.
Queries are strongly consistent and are guaranteed to return the most recent state. This means that the data reflects the state of all confirmed Events that came in before the Query was sent. An Event is considered confirmed if the call creating the Event returned success. Events that are created while the Query is outstanding may or may not be reflected in the Workflow state the Query result is based on.
A Query can carry arguments to specify the data it is requesting. And each Workflow can expose data to multiple types of Queries.
A Query must never mutate the state of the Workflow Execution— that is, Queries are read-only and cannot contain any blocking code. This means, for example, that Query handling logic cannot schedule Activity Executions.
Sending Queries to completed Workflow Executions is supported, though Query reject conditions can be configured per Query
Constructors
(Codec codec result, ApplyPayloads codec args, GatherArgs codec args) => KnownQuery | |
Fields
|
Instances
QueryRef (KnownQuery args result) Source # | |||||||||
Defined in Temporal.Workflow.Query Associated Types
Methods queryRef :: KnownQuery args result -> KnownQuery (QueryArgs (KnownQuery args result)) (QueryResult (KnownQuery args result)) Source # | |||||||||
type QueryArgs (KnownQuery args result) Source # | |||||||||
Defined in Temporal.Workflow.Query | |||||||||
type QueryResult (KnownQuery args result) Source # | |||||||||
Defined in Temporal.Workflow.Query |
setQueryHandler :: (QueryRef query, f ~ (QueryArgs query :->: Query (QueryResult query)), RequireCallStack) => query -> f -> Workflow () Source #
Register a query handler.
The handler will be called when a query with the given name is received.
Signals
class SignalRef sig where Source #
Associated Types
type SignalArgs sig :: [Type] Source #
Methods
signalRef :: sig -> KnownSignal (SignalArgs sig) Source #
Instances
SignalRef (KnownSignal args) Source # | |||||
Defined in Temporal.Workflow.Signal Associated Types
Methods signalRef :: KnownSignal args -> KnownSignal (SignalArgs (KnownSignal args)) Source # |
data KnownSignal (args :: [Type]) Source #
Constructors
(ApplyPayloads codec args, GatherArgs codec args) => KnownSignal | |
Fields
|
Instances
SignalRef (KnownSignal args) Source # | |||||
Defined in Temporal.Workflow.Signal Associated Types
Methods signalRef :: KnownSignal args -> KnownSignal (SignalArgs (KnownSignal args)) Source # | |||||
type SignalArgs (KnownSignal args) Source # | |||||
Defined in Temporal.Workflow.Signal |
setSignalHandler :: (ValidSignalHandler f, RequireCallStack, SignalRef ref, ArgsOf f ~ SignalArgs ref) => ref -> f -> Workflow () Source #
A very restricted Monad that allows for reading StateVar
values. This Monad
keeps track of which StateVar
values are read so that it can block and retry
the computation if any of the values change.
Instances
Applicative Condition Source # | |
Defined in Temporal.Workflow.Internal.Monad | |
Functor Condition Source # | |
Monad Condition Source # | |
MonadReadStateVar Condition Source # | |
Defined in Temporal.Workflow.Internal.Monad Methods readStateVar :: StateVar a -> Condition a Source # |
waitCondition :: RequireCallStack => Condition Bool -> Workflow () Source #
Wait on a condition to become true before continuing.
This must be used with signals, steps executed concurrently via the Applicative instance,
or with the race
command, as those are the only way for
state to change in a workflow while a portion of the workflow itself is
in this blocking condition.
N.B. this should be used with care, as it can lead to the workflow suspending indefinitely if the condition is never met. (e.g. if there is no signal handler that changes the state appropriately)
Other utilities
unsafeAsyncEffectSink :: RequireCallStack => IO () -> Workflow () Source #
While workflows are deterministic, there are categories of operational concerns (metrics, logging, tracing, etc.) that require
access to IO operations like the network or filesystem. The IO
monad is not generally available in the Workflow
monad, but you
can use sink
to run an IO
action in a workflow. In order to maintain determinism, the operation will be executed asynchronously
and does not return a value. Be sure that the sink operation terminates, or else you will leak memory and/or threads.
Do not use sink
for any Workflow logic, or else you will violate determinism.
State vars
StateVar
values are mutable variables scoped to a Workflow run.
Workflow
s are deterministic, so you may not use normal IORefs, since the IORef
could have been created outside of the workflow and cause nondeterminism.
However, it is totally safe to mutate state variables as long as they are scoped to a workflow and derive their state transitions from the workflow's deterministic execution.
StateVar values may also be read from within a query and mutated within signal handlers.
Instances
Eq (StateVar a) Source # | |
Ord (StateVar a) Source # | |
Defined in Temporal.Workflow.Internal.Monad |
newStateVar :: a -> Workflow (StateVar a) Source #
class MonadReadStateVar (m :: Type -> Type) where Source #
Methods
readStateVar :: StateVar a -> m a Source #
Instances
MonadReadStateVar Condition Source # | |
Defined in Temporal.Workflow.Internal.Monad Methods readStateVar :: StateVar a -> Condition a Source # | |
MonadReadStateVar Query Source # | |
Defined in Temporal.Workflow.Internal.Monad Methods readStateVar :: StateVar a -> Query a Source # | |
MonadReadStateVar Workflow Source # | |
Defined in Temporal.Workflow.Internal.Monad Methods readStateVar :: StateVar a -> Workflow a Source # |
class MonadWriteStateVar (m :: Type -> Type) where Source #
Methods
writeStateVar :: StateVar a -> a -> m () Source #
modifyStateVar :: StateVar a -> (a -> a) -> m () Source #
Instances
MonadWriteStateVar Workflow Source # | |
Defined in Temporal.Workflow.Internal.Monad Methods writeStateVar :: StateVar a -> a -> Workflow () Source # modifyStateVar :: StateVar a -> (a -> a) -> Workflow () Source # |
Time and timers
time :: RequireCallStack => Workflow SystemTime Source #
Current time from the workflow perspective.
The value is relative to epoch time.
Instances
Cancel Timer Source # | |||||
Defined in Temporal.Workflow Associated Types
| |||||
Wait Timer Source # | |||||
Defined in Temporal.Workflow Associated Types
| |||||
type CancelResult Timer Source # | |||||
Defined in Temporal.Workflow | |||||
type WaitResult Timer Source # | |||||
Defined in Temporal.Workflow |
createTimer :: Duration -> Workflow (Maybe Timer) Source #
Asynchronous sleep.
Creates a timer that fires after the specified duration.
The timer is not guaranteed to fire immediately after the duration expires, but it is intended to fire as close to the expiration as possible.
Note that the timer is started when the command is received by the Temporal Platform,
not when the timer is created. The command is sent as soon as the workflow is blocked
by any operation, such as sleep
, awaitCondition
, awaitActivity
, awaitWorkflow
, etc.
If the duration is less than or equal to zero, the timer will not be created.
scheduledTime :: Workflow (Maybe UTCTime) Source #
When using the Schedules feature of Temporal, this is the effective time that an instance was scheduled to run,
according to the TemporalScheduledStartTime
search attribute.
This is useful for backfilling or retrying a scheduled Workflow if you need the schedule to have a stable start time.
Workflow cancellation
isCancelRequested :: RequireCallStack => Workflow Bool Source #
Workflow
s may be sent a cancellation request from the Temporal Platform,
but Workflow code is not required to respond to the cancellation request.
In order to opt in to cancellation handling, you can call isCancelRequested
periodically within your workflow code to check whether a cancellation request
has been received.
waitCancellation :: RequireCallStack => Workflow () Source #
Block the current workflow's main execution thread until the workflow is cancelled.
The workflow can still respond to signals and queries while waiting for cancellation.
Upon cancellation, the workflow will throw a WorkflowCancelRequested
exception.
This function is useful for actor-style workflows that perform work in response to signals and/or respond to queries, but otherwise need to remain idle on their main codepath.
N.B. It is likely not safe to call this in a signal handler.
Random value generation
Workflow executions are deterministic, so you can't use the usual IO-based random number generation.
Instead, each workflow execution is given a seed from the Temporal platform to seed a PRNG. This allows you to generate random values in a deterministic way.
The Workflow
monad provides a RandomGen
instance, so you can use the usual random
and randomR
functions from the Random
and Stateful
modules.
randomGen :: Workflow WorkflowGenM Source #
Get a mutable randomness generator for the workflow.
uuid4 :: Workflow UUID Source #
Generate an RFC compliant V4 uuid.
Uses the workflow's deterministic PRNG, making it safe for use within a workflow.
This function is cryptographically insecure.
uuid7 :: RequireCallStack => Workflow UUID Source #
Generates a UUIDv7 using the current time (from time
) and
random data (from workflowRandomnessSeed
).
data WorkflowGenM Source #
Instances
StatefulGen WorkflowGenM Workflow Source # | |
Defined in Temporal.Workflow.Internal.Monad Methods uniformWord32R :: Word32 -> WorkflowGenM -> Workflow Word32 # uniformWord64R :: Word64 -> WorkflowGenM -> Workflow Word64 # uniformWord8 :: WorkflowGenM -> Workflow Word8 # uniformWord16 :: WorkflowGenM -> Workflow Word16 # uniformWord32 :: WorkflowGenM -> Workflow Word32 # uniformWord64 :: WorkflowGenM -> Workflow Word64 # uniformShortByteString :: Int -> WorkflowGenM -> Workflow ShortByteString # | |
RandomGenM WorkflowGenM StdGen Workflow Source # | |
Defined in Temporal.Workflow.Internal.Monad Methods applyRandomGenM :: (StdGen -> (a, StdGen)) -> WorkflowGenM -> Workflow a # |
Continue as new
data ContinueAsNewOptions Source #
Constructors
ContinueAsNewOptions | |
Fields |
Instances
Show ContinueAsNewOptions Source # | |
Defined in Temporal.Workflow.Types Methods showsPrec :: Int -> ContinueAsNewOptions -> ShowS # show :: ContinueAsNewOptions -> String # showList :: [ContinueAsNewOptions] -> ShowS # | |
Eq ContinueAsNewOptions Source # | |
Defined in Temporal.Workflow.Types Methods (==) :: ContinueAsNewOptions -> ContinueAsNewOptions -> Bool # (/=) :: ContinueAsNewOptions -> ContinueAsNewOptions -> Bool # | |
Lift ContinueAsNewOptions Source # | |
Defined in Temporal.Workflow.Types Methods lift :: Quote m => ContinueAsNewOptions -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ContinueAsNewOptions -> Code m ContinueAsNewOptions # |
Arguments
:: WorkflowRef wf | |
=> wf | The workflow to continue as new. It doesn't have to be the same as the current workflow. |
-> ContinueAsNewOptions | |
-> WorkflowArgs wf :->: Workflow (WorkflowResult wf) |
Continue-As-New is a mechanism by which the latest relevant state is passed to a new Workflow Execution, with a fresh Event History.
As a precautionary measure, the Temporal Platform limits the total Event History to 51,200 Events or 50 MB, and will warn you after 10,240 Events or 10 MB. To prevent a Workflow Execution Event History from exceeding this limit and failing, use Continue-As-New to start a new Workflow Execution with a fresh Event History.
All values passed to a Workflow Execution through parameters or returned through a result value are recorded into the Event History. A Temporal Cluster stores the full Event History of a Workflow Execution for the duration of a Namespace's retention period. A Workflow Execution that periodically executes many Activities has the potential of hitting the size limit.
A very large Event History can adversely affect the performance of a Workflow Execution. For example, in the case of a Workflow Worker failure, the full Event History must be pulled from the Temporal Cluster and given to another Worker via a Workflow Task. If the Event history is very large, it may take some time to load it.
The Continue-As-New feature enables developers to complete the current Workflow Execution and start a new one atomically.
The new Workflow Execution has the same Workflow Id, but a different Run Id, and has its own Event History. TODO, don't make this an exception, make it a return value
Type definitions
newtype ActivityId Source #
A unique identifier for an Activity Execution.
Constructors
ActivityId | |
Fields |
Instances
FromJSON ActivityId Source # | |
Defined in Temporal.Common | |
ToJSON ActivityId Source # | |
Defined in Temporal.Common Methods toJSON :: ActivityId -> Value # toEncoding :: ActivityId -> Encoding # toJSONList :: [ActivityId] -> Value # toEncodingList :: [ActivityId] -> Encoding # omitField :: ActivityId -> Bool # | |
IsString ActivityId Source # | |
Defined in Temporal.Common Methods fromString :: String -> ActivityId # | |
Show ActivityId Source # | |
Defined in Temporal.Common Methods showsPrec :: Int -> ActivityId -> ShowS # show :: ActivityId -> String # showList :: [ActivityId] -> ShowS # | |
Eq ActivityId Source # | |
Defined in Temporal.Common | |
Ord ActivityId Source # | |
Defined in Temporal.Common Methods compare :: ActivityId -> ActivityId -> Ordering # (<) :: ActivityId -> ActivityId -> Bool # (<=) :: ActivityId -> ActivityId -> Bool # (>) :: ActivityId -> ActivityId -> Bool # (>=) :: ActivityId -> ActivityId -> Bool # max :: ActivityId -> ActivityId -> ActivityId # min :: ActivityId -> ActivityId -> ActivityId # | |
Hashable ActivityId Source # | |
Defined in Temporal.Common | |
Lift ActivityId Source # | |
Defined in Temporal.Common Methods lift :: Quote m => ActivityId -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ActivityId -> Code m ActivityId # |
newtype WorkflowId Source #
A Workflow Id is a customizable, application-level identifier for a Workflow Execution that is unique to an Open Workflow Execution within a Namespace.
Constructors
WorkflowId | |
Fields |
Instances
FromJSON WorkflowId Source # | |
Defined in Temporal.Common | |
ToJSON WorkflowId Source # | |
Defined in Temporal.Common Methods toJSON :: WorkflowId -> Value # toEncoding :: WorkflowId -> Encoding # toJSONList :: [WorkflowId] -> Value # toEncodingList :: [WorkflowId] -> Encoding # omitField :: WorkflowId -> Bool # | |
IsString WorkflowId Source # | |
Defined in Temporal.Common Methods fromString :: String -> WorkflowId # | |
Show WorkflowId Source # | |
Defined in Temporal.Common Methods showsPrec :: Int -> WorkflowId -> ShowS # show :: WorkflowId -> String # showList :: [WorkflowId] -> ShowS # | |
Eq WorkflowId Source # | |
Defined in Temporal.Common | |
Ord WorkflowId Source # | |
Defined in Temporal.Common Methods compare :: WorkflowId -> WorkflowId -> Ordering # (<) :: WorkflowId -> WorkflowId -> Bool # (<=) :: WorkflowId -> WorkflowId -> Bool # (>) :: WorkflowId -> WorkflowId -> Bool # (>=) :: WorkflowId -> WorkflowId -> Bool # max :: WorkflowId -> WorkflowId -> WorkflowId # min :: WorkflowId -> WorkflowId -> WorkflowId # | |
Hashable WorkflowId Source # | |
Defined in Temporal.Common | |
Lift WorkflowId Source # | |
Defined in Temporal.Common Methods lift :: Quote m => WorkflowId -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => WorkflowId -> Code m WorkflowId # |
A Namespace is a unit of isolation within the Temporal Platform
Constructors
Namespace | |
Fields
|
Instances
FromJSON Namespace Source # | |
Defined in Temporal.Common | |
ToJSON Namespace Source # | |
IsString Namespace Source # | |
Defined in Temporal.Common Methods fromString :: String -> Namespace # | |
Show Namespace Source # | |
Eq Namespace Source # | |
Ord Namespace Source # | |
Hashable Namespace Source # | |
Defined in Temporal.Common | |
Lift Namespace Source # | |
A Task Queue is a queue that a Worker Process polls for Tasks.
Task Queues do not have any ordering guarantees. It is possible to have a Task that stays in a Task Queue for a period of time, if there is a backlog that wasn't drained for that time.
Task Queues are very lightweight components. Task Queues do not require explicit registration but instead are created on demand when a Workflow Execution or Activity spawns or when a Worker Process subscribes to it. When a Task Queue is created, both a Workflow Task Queue and an Activity Task Queue are created under the same name. There is no limit to the number of Task Queues a Temporal Application can use or a Temporal Cluster can maintain.
Constructors
TaskQueue | |
Fields
|
Instances
FromJSON TaskQueue Source # | |
Defined in Temporal.Common | |
ToJSON TaskQueue Source # | |
Data TaskQueue Source # | |
Defined in Temporal.Common Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TaskQueue -> c TaskQueue # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TaskQueue # toConstr :: TaskQueue -> Constr # dataTypeOf :: TaskQueue -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TaskQueue) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TaskQueue) # gmapT :: (forall b. Data b => b -> b) -> TaskQueue -> TaskQueue # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TaskQueue -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TaskQueue -> r # gmapQ :: (forall d. Data d => d -> u) -> TaskQueue -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TaskQueue -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TaskQueue -> m TaskQueue # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TaskQueue -> m TaskQueue # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TaskQueue -> m TaskQueue # | |
IsString TaskQueue Source # | |
Defined in Temporal.Common Methods fromString :: String -> TaskQueue # | |
Show TaskQueue Source # | |
Eq TaskQueue Source # | |
Ord TaskQueue Source # | |
Hashable TaskQueue Source # | |
Defined in Temporal.Common | |
Lift TaskQueue Source # | |
Constructors
PatchId | |
Fields
|
Instances
FromJSON PatchId Source # | |
Defined in Temporal.Common | |
ToJSON PatchId Source # | |
IsString PatchId Source # | |
Defined in Temporal.Common Methods fromString :: String -> PatchId # | |
Show PatchId Source # | |
Eq PatchId Source # | |
Ord PatchId Source # | |
Hashable PatchId Source # | |
Defined in Temporal.Common | |
Lift PatchId Source # | |
A Run Id is a globally unique, platform-level identifier for a Workflow Execution.
The current Run Id is mutable and can change during a Workflow Retry. You shouldn't rely on storing the current Run Id, or using it for any logical choices, because a Workflow Retry changes the Run Id and can lead to non-determinism issues.
Temporal guarantees that only one Workflow Execution with a given Workflow Id can be in an Open state at any given time. But when a Workflow Execution reaches a Closed state, it is possible to have another Workflow Execution in an Open state with the same Workflow Id. For example, a Temporal Cron Job is a chain of Workflow Executions that all have the same Workflow Id. Each Workflow Execution within the chain is considered a Run.
A Run Id uniquely identifies a Workflow Execution even if it shares a Workflow Id with other Workflow Executions.
Instances
data ParentClosePolicy Source #
Used by the service to determine the fate of a child workflow in case its parent is closed.
Constructors
ParentClosePolicyUnspecified | Lets the server set the default. |
ParentClosePolicyTerminate | Terminate the child workflow. |
ParentClosePolicyAbandon | Do not terminate the child workflow. The child workflow continues to run. |
ParentClosePolicyRequestCancel | Request cancellation on the child workflow. |
Instances
Data ParentClosePolicy Source # | |
Defined in Temporal.Workflow.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ParentClosePolicy -> c ParentClosePolicy # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ParentClosePolicy # toConstr :: ParentClosePolicy -> Constr # dataTypeOf :: ParentClosePolicy -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ParentClosePolicy) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ParentClosePolicy) # gmapT :: (forall b. Data b => b -> b) -> ParentClosePolicy -> ParentClosePolicy # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ParentClosePolicy -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ParentClosePolicy -> r # gmapQ :: (forall d. Data d => d -> u) -> ParentClosePolicy -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ParentClosePolicy -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ParentClosePolicy -> m ParentClosePolicy # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ParentClosePolicy -> m ParentClosePolicy # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ParentClosePolicy -> m ParentClosePolicy # | |
Show ParentClosePolicy Source # | |
Defined in Temporal.Workflow.Types Methods showsPrec :: Int -> ParentClosePolicy -> ShowS # show :: ParentClosePolicy -> String # showList :: [ParentClosePolicy] -> ShowS # | |
Eq ParentClosePolicy Source # | |
Defined in Temporal.Workflow.Types Methods (==) :: ParentClosePolicy -> ParentClosePolicy -> Bool # (/=) :: ParentClosePolicy -> ParentClosePolicy -> Bool # | |
Ord ParentClosePolicy Source # | |
Defined in Temporal.Workflow.Types Methods compare :: ParentClosePolicy -> ParentClosePolicy -> Ordering # (<) :: ParentClosePolicy -> ParentClosePolicy -> Bool # (<=) :: ParentClosePolicy -> ParentClosePolicy -> Bool # (>) :: ParentClosePolicy -> ParentClosePolicy -> Bool # (>=) :: ParentClosePolicy -> ParentClosePolicy -> Bool # max :: ParentClosePolicy -> ParentClosePolicy -> ParentClosePolicy # min :: ParentClosePolicy -> ParentClosePolicy -> ParentClosePolicy # | |
Lift ParentClosePolicy Source # | |
Defined in Temporal.Workflow.Types Methods lift :: Quote m => ParentClosePolicy -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ParentClosePolicy -> Code m ParentClosePolicy # |
data ChildWorkflowCancellationType Source #
Controls at which point to report back when a child workflow is cancelled.
Constructors
ChildWorkflowCancellationAbandon | Do not request cancellation of the child workflow if already scheduled |
ChildWorkflowCancellationTryCancel | Initiate a cancellation request and immediately report cancellation to the parent workflow |
ChildWorkflowCancellationWaitCancellationCompleted | Wait for child cancellation completion. |
ChildWorkflowCancellationWaitCancellationRequested | Request cancellation of the child and wait for confirmation that the request was received. |
Instances
Data ChildWorkflowCancellationType Source # | |
Defined in Temporal.Workflow.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ChildWorkflowCancellationType -> c ChildWorkflowCancellationType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ChildWorkflowCancellationType # toConstr :: ChildWorkflowCancellationType -> Constr # dataTypeOf :: ChildWorkflowCancellationType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ChildWorkflowCancellationType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ChildWorkflowCancellationType) # gmapT :: (forall b. Data b => b -> b) -> ChildWorkflowCancellationType -> ChildWorkflowCancellationType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ChildWorkflowCancellationType -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ChildWorkflowCancellationType -> r # gmapQ :: (forall d. Data d => d -> u) -> ChildWorkflowCancellationType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ChildWorkflowCancellationType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ChildWorkflowCancellationType -> m ChildWorkflowCancellationType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ChildWorkflowCancellationType -> m ChildWorkflowCancellationType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ChildWorkflowCancellationType -> m ChildWorkflowCancellationType # | |
Show ChildWorkflowCancellationType Source # | |
Defined in Temporal.Workflow.Types Methods showsPrec :: Int -> ChildWorkflowCancellationType -> ShowS # show :: ChildWorkflowCancellationType -> String # showList :: [ChildWorkflowCancellationType] -> ShowS # | |
Eq ChildWorkflowCancellationType Source # | |
Defined in Temporal.Workflow.Types | |
Ord ChildWorkflowCancellationType Source # | |
Defined in Temporal.Workflow.Types Methods compare :: ChildWorkflowCancellationType -> ChildWorkflowCancellationType -> Ordering # (<) :: ChildWorkflowCancellationType -> ChildWorkflowCancellationType -> Bool # (<=) :: ChildWorkflowCancellationType -> ChildWorkflowCancellationType -> Bool # (>) :: ChildWorkflowCancellationType -> ChildWorkflowCancellationType -> Bool # (>=) :: ChildWorkflowCancellationType -> ChildWorkflowCancellationType -> Bool # max :: ChildWorkflowCancellationType -> ChildWorkflowCancellationType -> ChildWorkflowCancellationType # min :: ChildWorkflowCancellationType -> ChildWorkflowCancellationType -> ChildWorkflowCancellationType # | |
Lift ChildWorkflowCancellationType Source # | |
Defined in Temporal.Workflow.Types Methods lift :: Quote m => ChildWorkflowCancellationType -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ChildWorkflowCancellationType -> Code m ChildWorkflowCancellationType # |
data WorkflowIdReusePolicy Source #
A Workflow Id Reuse Policy determines whether a Workflow Execution is allowed to spawn with a particular Workflow Id, if that Workflow Id has been used with a previous, and now Closed, Workflow Execution.
It is not possible for a new Workflow Execution to spawn with the same Workflow Id as another Open Workflow Execution, regardless of the Workflow Id Reuse Policy. In some cases, an attempt to spawn a Workflow Execution with a Workflow Id that is the same as the Id of a currently Open Workflow Execution results in a Workflow execution already started error.
Constructors
WorkflowIdReusePolicyUnspecified | |
WorkflowIdReusePolicyAllowDuplicate | The Workflow Execution is allowed to exist regardless of the Closed status of a previous Workflow Execution with the same Workflow Id. This is currently the default policy, if one is not specified. Use this when it is OK to have a Workflow Execution with the same Workflow Id as a previous, but now Closed, Workflow Execution. |
WorkflowIdReusePolicyAllowDuplicateFailedOnly | The Workflow Execution is allowed to exist only if a previous Workflow Execution with the same Workflow Id does not have a Completed status. Use this policy when there is a need to re-execute a Failed, Timed Out, Terminated or Cancelled Workflow Execution and guarantee that the Completed Workflow Execution will not be re-executed. |
WorkflowIdReusePolicyRejectDuplicate | The Workflow Execution cannot exist if a previous Workflow Execution has the same Workflow Id, regardless of the Closed status. Use this when there can only be one Workflow Execution per Workflow Id within a Namespace for the given retention period. |
WorkflowIdReusePolicyTerminateIfRunning | Specifies that if a Workflow Execution with the same Workflow Id is already running, it should be terminated and a new Workflow Execution with the same Workflow Id should be started. This policy allows for only one Workflow Execution with a specific Workflow Id to be running at any given time. |
Instances
FromJSON WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Methods parseJSON :: Value -> Parser WorkflowIdReusePolicy # parseJSONList :: Value -> Parser [WorkflowIdReusePolicy] # | |||||
ToJSON WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Methods toJSON :: WorkflowIdReusePolicy -> Value # toEncoding :: WorkflowIdReusePolicy -> Encoding # toJSONList :: [WorkflowIdReusePolicy] -> Value # toEncodingList :: [WorkflowIdReusePolicy] -> Encoding # omitField :: WorkflowIdReusePolicy -> Bool # | |||||
Data WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WorkflowIdReusePolicy -> c WorkflowIdReusePolicy # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WorkflowIdReusePolicy # toConstr :: WorkflowIdReusePolicy -> Constr # dataTypeOf :: WorkflowIdReusePolicy -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WorkflowIdReusePolicy) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WorkflowIdReusePolicy) # gmapT :: (forall b. Data b => b -> b) -> WorkflowIdReusePolicy -> WorkflowIdReusePolicy # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WorkflowIdReusePolicy -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WorkflowIdReusePolicy -> r # gmapQ :: (forall d. Data d => d -> u) -> WorkflowIdReusePolicy -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> WorkflowIdReusePolicy -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> WorkflowIdReusePolicy -> m WorkflowIdReusePolicy # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WorkflowIdReusePolicy -> m WorkflowIdReusePolicy # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WorkflowIdReusePolicy -> m WorkflowIdReusePolicy # | |||||
Bounded WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common | |||||
Enum WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Methods succ :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy # pred :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy # toEnum :: Int -> WorkflowIdReusePolicy # fromEnum :: WorkflowIdReusePolicy -> Int # enumFrom :: WorkflowIdReusePolicy -> [WorkflowIdReusePolicy] # enumFromThen :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> [WorkflowIdReusePolicy] # enumFromTo :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> [WorkflowIdReusePolicy] # enumFromThenTo :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> [WorkflowIdReusePolicy] # | |||||
Generic WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Associated Types
Methods from :: WorkflowIdReusePolicy -> Rep WorkflowIdReusePolicy x # to :: Rep WorkflowIdReusePolicy x -> WorkflowIdReusePolicy # | |||||
Read WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Methods readsPrec :: Int -> ReadS WorkflowIdReusePolicy # readList :: ReadS [WorkflowIdReusePolicy] # | |||||
Show WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Methods showsPrec :: Int -> WorkflowIdReusePolicy -> ShowS # show :: WorkflowIdReusePolicy -> String # showList :: [WorkflowIdReusePolicy] -> ShowS # | |||||
Eq WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Methods (==) :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> Bool # (/=) :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> Bool # | |||||
Ord WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Methods compare :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> Ordering # (<) :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> Bool # (<=) :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> Bool # (>) :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> Bool # (>=) :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> Bool # max :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> WorkflowIdReusePolicy # min :: WorkflowIdReusePolicy -> WorkflowIdReusePolicy -> WorkflowIdReusePolicy # | |||||
Lift WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common Methods lift :: Quote m => WorkflowIdReusePolicy -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => WorkflowIdReusePolicy -> Code m WorkflowIdReusePolicy # | |||||
type Rep WorkflowIdReusePolicy Source # | |||||
Defined in Temporal.Common type Rep WorkflowIdReusePolicy = D1 ('MetaData "WorkflowIdReusePolicy" "Temporal.Common" "temporal-sdk-0.0.1.0-inplace" 'False) ((C1 ('MetaCons "WorkflowIdReusePolicyUnspecified" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WorkflowIdReusePolicyAllowDuplicate" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "WorkflowIdReusePolicyAllowDuplicateFailedOnly" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WorkflowIdReusePolicyRejectDuplicate" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WorkflowIdReusePolicyTerminateIfRunning" 'PrefixI 'False) (U1 :: Type -> Type)))) |
newtype WorkflowType Source #
This is generally the name of the function itself
Constructors
WorkflowType | |
Fields |
Instances
FromJSON WorkflowType Source # | |
Defined in Temporal.Common | |
ToJSON WorkflowType Source # | |
Defined in Temporal.Common Methods toJSON :: WorkflowType -> Value # toEncoding :: WorkflowType -> Encoding # toJSONList :: [WorkflowType] -> Value # toEncodingList :: [WorkflowType] -> Encoding # omitField :: WorkflowType -> Bool # | |
IsString WorkflowType Source # | |
Defined in Temporal.Common Methods fromString :: String -> WorkflowType # | |
Show WorkflowType Source # | |
Defined in Temporal.Common Methods showsPrec :: Int -> WorkflowType -> ShowS # show :: WorkflowType -> String # showList :: [WorkflowType] -> ShowS # | |
Eq WorkflowType Source # | |
Defined in Temporal.Common | |
Ord WorkflowType Source # | |
Defined in Temporal.Common Methods compare :: WorkflowType -> WorkflowType -> Ordering # (<) :: WorkflowType -> WorkflowType -> Bool # (<=) :: WorkflowType -> WorkflowType -> Bool # (>) :: WorkflowType -> WorkflowType -> Bool # (>=) :: WorkflowType -> WorkflowType -> Bool # max :: WorkflowType -> WorkflowType -> WorkflowType # min :: WorkflowType -> WorkflowType -> WorkflowType # | |
Hashable WorkflowType Source # | |
Defined in Temporal.Common | |
Lift WorkflowType Source # | |
Defined in Temporal.Common Methods lift :: Quote m => WorkflowType -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => WorkflowType -> Code m WorkflowType # |
type RequireCallStack = (HasCallStack, RequireCallStackImpl) #
This constraint is similar to HasCallStack
in that it's presence
will capture a stack frame for the call site of the function. Unlike
HasCallStack
, this is not a "magic" constraint that is automagically
solved by GHC, which means that calling a function with this constraint
will cause GHC to ask you to add this constraint to your own function.
For example, let's say you have a function unsafeHead ::
. Then you go to call that function:RequireCallStack
=>
[a] -> a
myCoolFunction :: [Int] -> Int myCoolFunction = unsafeHead
GHC will complain about the lack of the RequireCallStack
constraint.
You will have two options:
- Add the constraint to your functions. This is a good option because
it means the callstack from
unsafeHead
will include themyCoolFunction
callsite as well.
myCoolFunction :: RequireCallStack => [Int] -> Int myCoolFunction = unsafeHead
- Use
provideCallStack
to silence the error. This will truncate the callstack unless you useHasCallStack
above. You should only do this if you're confident that you don't need any debugging information from a more complete callstack.
myCoolFunction :: [Int] -> Int
myCoolFunction = provideCallStack
unsafeHead
Since: require-callstack-0.1.0.0
data TimeoutOptions Source #
Constructors
TimeoutOptions | |
Fields
|
Instances
Data TimeoutOptions Source # | |
Defined in Temporal.Common Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TimeoutOptions -> c TimeoutOptions # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeoutOptions # toConstr :: TimeoutOptions -> Constr # dataTypeOf :: TimeoutOptions -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeoutOptions) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeoutOptions) # gmapT :: (forall b. Data b => b -> b) -> TimeoutOptions -> TimeoutOptions # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeoutOptions -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeoutOptions -> r # gmapQ :: (forall d. Data d => d -> u) -> TimeoutOptions -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeoutOptions -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeoutOptions -> m TimeoutOptions # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeoutOptions -> m TimeoutOptions # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeoutOptions -> m TimeoutOptions # | |
Show TimeoutOptions Source # | |
Defined in Temporal.Common Methods showsPrec :: Int -> TimeoutOptions -> ShowS # show :: TimeoutOptions -> String # showList :: [TimeoutOptions] -> ShowS # | |
Eq TimeoutOptions Source # | |
Defined in Temporal.Common Methods (==) :: TimeoutOptions -> TimeoutOptions -> Bool # (/=) :: TimeoutOptions -> TimeoutOptions -> Bool # | |
Lift TimeoutOptions Source # | |
Defined in Temporal.Common Methods lift :: Quote m => TimeoutOptions -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => TimeoutOptions -> Code m TimeoutOptions # |