Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensureTopicKindRegistered is not a good idea #1007

Open
qazwsxedckll opened this issue Dec 28, 2023 · 1 comment
Open

ensureTopicKindRegistered is not a good idea #1007

qazwsxedckll opened this issue Dec 28, 2023 · 1 comment

Comments

@qazwsxedckll
Copy link
Contributor

I wrote a custom topic actor kind with presistency.

	persistenceStore := NewPersistentKeyValueStore(s.logger, s.repo)
	topicActorKind := cluster.NewKind(cluster.TopicActorKind, actor.PropsFromProducer(func() actor.Actor {
		return cluster.NewTopicActor(persistenceStore, s.logger)
	}))

If I forget to configure it on some node, especially in heterogeneous cluster, some topic actor kind without persistency will be spawned and will cause some problem.

func (c *Cluster) ensureTopicKindRegistered() {
	hasTopicKind := false
	for name := range c.kinds {
		if name == TopicActorKind {
			hasTopicKind = true
			break
		}
	}
	if !hasTopicKind {
		store := &EmptyKeyValueStore[*Subscribers]{}

		c.kinds[TopicActorKind] = NewKind(TopicActorKind, actor.PropsFromProducer(func() actor.Actor {
			return NewTopicActor(store, c.Logger())
		})).Build(c)
	}
}

I think it should be added explicitly by user if pubsub functions is used rather than automatically.

@AqlaSolutions
Copy link

Same for dotnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants