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

后端消息队列可以改成接口吗 #27

Open
lchjczw opened this issue Jun 11, 2019 · 1 comment
Open

后端消息队列可以改成接口吗 #27

lchjczw opened this issue Jun 11, 2019 · 1 comment

Comments

@lchjczw
Copy link

lchjczw commented Jun 11, 2019

后端消息队列可以改成接口吗,后面有些情况下,可以用其他消息队列

Repository owner deleted a comment from vimerr Jun 17, 2019
@fanux
Copy link
Owner

fanux commented Jun 17, 2019

func (mq *Mq) Publish(key string, v MqHandler) error {
	return mq.conn.Publish(key, v)
}

func (mq *Mq) Subscribe(key string, v MqHandler) (*nats.Subscription, error) {
	return mq.conn.Subscribe(key, v)
}

/*
func (mq *Mq) Unsubscribe(sub *nats.Subscription) error {
	return sub.Unsubscribe()
}
*/

func (mq *Mq) Unsubscribe(handle interface{}) error {
	c :=handle.(*nats.Subscription)
	return c.Unsubscribe()
}

确实可以抽象成接口,有兴趣可参与这个项目进行改造

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