temporal icon indicating copy to clipboard operation
temporal copied to clipboard

Workflows/activities to post event notifications that could be listened to

Open sstro opened this issue 2 years ago • 5 comments

We would like to listen to Temporal workflow/activity lifecycle events (e.g. WorkflowExecutionStarted, ActivityTaskStarted, ActivityTaskCompleted), apply some filtering and transformation and then persist the events to our own database. Business users could query this database directly instead of querying Temporal and transforming/aggregating information at the runtime.

An additional requirement would be ability to distinguish workflow / activity replay / retry events from "first execution" events.

It would be nice if it were possible to attach some kind of listener to a workflow / an activity at the worker level.

We've considered workflow/activity inbound/outbound call interceptors, however, they only seem to fire on a subset of events (start/finish). Additionally, workflow interceptors do not distinguish first start and replay events.

We would be interested in having the functionality available in Java SDK.

Related discussions in the support forum:

  • https://community.temporal.io/t/how-to-watch-all-workflows-events-inside-a-namespace/4658
  • https://community.temporal.io/t/way-to-listen-on-workflow-lifecycle-events/5887
  • https://community.temporal.io/t/consume-temporal-io-events/1630
  • https://community.temporal.io/t/can-i-attach-a-listener-to-workflow-execution/4275

sstro avatar Dec 14 '22 08:12 sstro

Is this a use case for having the ability to create a custom UI (user interface)?

mindaugasrukas avatar Dec 14 '22 17:12 mindaugasrukas

Not exactly, it's for integration with our own process information system.

sstro avatar Dec 15 '22 08:12 sstro

We have 2 options currently available:

  1. use interceptor to intercept workflow/activity, example https://github.com/temporalio/samples-go/tree/main/interceptor
  2. intercept calls using a proxy, example: https://github.com/temporalio/samples-go/tree/main/grpc-proxy

yiminc avatar Dec 16 '22 22:12 yiminc

We've considered workflow/activity inbound/outbound call interceptors, however, they only seem to fire on a subset of events (start/finish). Additionally, workflow interceptors do not distinguish first start and replay events, which is important for our use case.

Is the proxy supported in Java SDK ?

sstro avatar Dec 19 '22 09:12 sstro

Proxy and interceptors are not a complete solution for this issue since they are not invoked on server side workflow completions like timeout or termination.

Quinn-With-Two-Ns avatar Dec 20 '23 18:12 Quinn-With-Two-Ns