SetOnActivityHeartbeatListener: How Do I Use This?

Hi,

I’m trying to test some activity code. Ideally, I want to check that the code is heartbeating. I thought to use SetOnActivityHeartbeatListener, but I don’t think I can because ActivityInfo is internal. Did I miss something? Should I be looking to do this in a different way?

Albert

It has a public activity.Info alias.

Thank you! I see now it is in the code documentation. Oops.

For others:

import (
	"go.temporal.io/sdk/activity"
	"go.temporal.io/sdk/converter"
	"go.temporal.io/sdk/testsuite"
	"testing"
)

func TestSomething(t *testing.T) {
	testSuite := &testsuite.WorkflowTestSuite{}
	env := testSuite.NewTestActivityEnvironment()
	env.RegisterActivity(activityFunc)
	env.SetOnActivityHeartbeatListener(func(activityInfo *activity.Info, details converter.EncodedValues) {
		// code goes here
	})

	d, err := env.ExecuteActivity(activityFunc, params)
	...
}