temporal-sdk
Safe HaskellNone
LanguageHaskell2010

Temporal.Interceptor

Description

Temporal interceptors allow you to customize and extend the behavior of workflows and activities by intercepting and modifying their execution at various points. Interceptors can be used to add cross-cutting concerns, such as logging, security, or monitoring, to your Temporal applications.

This module provides types and functions for defining and composing interceptors for different parts of Temporal workflows and activities.

Types for different types of interceptors:

Functions for composing interceptors:

Example usage of interceptors:

myActivityInterceptor :: ActivityInboundInterceptor
myActivityInterceptor = ActivityInboundInterceptor
  { executeActivity = \input next -> do
      -- Perform custom logic before calling the activity function
      result <- next input
      -- Perform custom logic after the activity function completes
      return result
  }
  • Compose multiple interceptors using Semigroup instances.
combinedInterceptor :: Interceptor
combinedInterceptor = bugsnagInterceptor <> encryptionInterceptor <> otelInterceptor
  • Provide the interceptors to the Temporal Workflow client and worker.
Synopsis

Documentation

interceptorConvertChildWorkflowHandle :: ChildWorkflowHandle a -> (a -> IO b) -> ChildWorkflowHandle b Source #

This is only intended for use by interceptors. Normal workflow code should be able to use the fmap instance for simple transformations or else provide an appropriate codec.