Is it possible to inject non-serializable objects to activity implementations?

I would like to inject the backend client API into the activity implementation class.

Consider this implementation for an activity:

class SignupActivitiesImpl(private val client: ClientApi) : SignupActivities {

    override fun sendConfirmationEmail(signup: SignupSafe, token: String) {
        client.sendEmail(
            Email(
                "confirm-email",
                "Confirmação de email",
                signup.email,
                mapOf(
                    "firstName" to signup.firstName,
                    "token" to token
                )
            )
        )
    }
}

Can I pass a non-serializable object, like the client instance to an activity implementation class?

This is what I need to do:


// The clientApi is a proxy object, not serializable.
val clientApi: ClientApi = getClientApi()

// Partial code example, the worker instance has been configured previously.
worker.registerActivitiesImplementations(arrayOf(SignupActivitiesImpl(clientApi)))

Yes, you can pass client as input of your activity impl constructor when you register it with worker.

Thanks, @tihomir.