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

Dialer pool. #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Dialer pool. #50

wants to merge 1 commit into from

Conversation

makasim
Copy link
Owner

@makasim makasim commented Nov 15, 2020

Maintain several connections to different RabbitMQ servers under the hood. Serve to clients only healthy connections. Exclude unhealthy until recovered.

package main

import (
	"github.com/makasim/amqpextra"
	"github.com/makasim/amqpextra/publisher"
)

func main() {
	d1, _ := amqpextra.NewDialer(
		amqpextra.WithURL("amqp://guest:guest@foo-rabbitmq:5672/"),
	)
	d2, _ := amqpextra.NewDialer(
		amqpextra.WithURL("amqp://guest:guest@bar-rabbitmq2:5672/"),
	)

	connCh := amqpextra.NewDialerPool(d1, d2)

	p, _ := amqpextra.NewPublisher(connCh)
	p.Publish(publisher.Message{
		Exchange: "foo",
	})
}

fixes #48

TODO:

  • tests
  • doc

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

Successfully merging this pull request may close these issues.

Dialer pool
1 participant