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

WizardBus should not serialize/deserialize in-memory messages #72

Closed
grepory opened this issue Apr 17, 2017 · 2 comments
Closed

WizardBus should not serialize/deserialize in-memory messages #72

grepory opened this issue Apr 17, 2017 · 2 comments

Comments

@grepory
Copy link
Contributor

grepory commented Apr 17, 2017

The current MessageBus interface should be replaced as such:

// MessageBus is the interface to the internal messaging system. It must be
// safe to be used by multiple goroutines.
type MessageBus interface {
	daemon.Daemon

	// Subscribe allows a consumer to subscribe to a topic,
	// binding a read-only channel to the topic. Topic messages
	// are delivered to the channel as simple byte arrays. Consumers should
	// use type assertions to convert the incoming messages to a pointer to an
	// appropriate value.
	Subscribe(topic string, consumer string, channel chan<- interface{}) error

	// Unsubscribe allows a consumer to unsubscribe from a topic,
	// removing its read-only channel from the topic's bindings.
	// The channel is not closed, as it may still having other
	// topic bindings.
	Unsubscribe(topic string, consumer string) error

	// Publish sends a message to a topic. Publishers should be sure to pass by
	// reference as this is intended to be used by multiple goroutines.
	Publish(topic string, message interface{}) error
}```

@grepory
Copy link
Contributor Author

grepory commented Apr 17, 2017

This is going to be a really crappy refactor, and is likely to break any WIP branch anyone has. I'm happy to volunteer as tribute to organize and/or do this work.

@grepory
Copy link
Contributor Author

grepory commented Apr 18, 2017

Oh yeah you can't assert on non-interface types.

@grepory grepory closed this as completed Apr 18, 2017
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

1 participant