Any problem calling an activity function from outside of a workflow?

Say I have some reusable function I want to use from both a workflow and outside of temporal – is there any problem with simply making that function a temporal activity and calling that activity outside of a temporal context?

@Shawn_Jones

Say I have some reusable function I want to use from both a workflow and outside of temporal

this should be ok as long as you don’t use any temporal api inside the function, otherwise it is not gonna work when you call outside of the temporal context

is there any problem with simply making that function a temporal activity and calling that activity outside of a temporal context?

do you mean “and calling that function outside of a temporal context?” or do you really want to invoke a temporal activity outside of workflow code?

Antonio

Yes I meant calling that function thank you. And the only thing imported from temporal is ApplicationFailure

As long as you don’t rely on activity context, you should be able to run the function directly.

Hi @antonio.perez
Am i able to execute an temporal activity without a need to a workflow ?
If yes, then please tell me how

No, Temporal doesn’t support stand alone activities yet.

1 Like

thanks @maxim