### Quick Start RabbitMQ Consumer in Go Source: https://github.com/wagslane/go-rabbitmq/blob/main/README.md Demonstrates how to establish a connection to RabbitMQ, create a consumer instance, configure it with options like routing key and exchange, and start consuming messages using a handler function. ```Go conn, err := rabbitmq.NewConn( "amqp://guest:guest@localhost", rabbitmq.WithConnectionOptionsLogging, ) if err != nil { log.Fatal(err) } defer conn.Close() consumer, err := rabbitmq.NewConsumer( conn, "my_queue", rabbitmq.WithConsumerOptionsRoutingKey("my_routing_key"), rabbitmq.WithConsumerOptionsExchangeName("events"), rabbitmq.WithConsumerOptionsExchangeDeclare, ) if err != nil { log.Fatal(err) } defer consumer.Close() err = consumer.Run(func(d rabbitmq.Delivery) rabbitmq.Action { log.Printf("consumed: %v", string(d.Body)) // rabbitmq.Ack, rabbitmq.NackDiscard, rabbitmq.NackRequeue return rabbitmq.Ack }) if err != nil { log.Fatal(err) } ``` -------------------------------- ### Run Static Checks (Shell) Source: https://github.com/wagslane/go-rabbitmq/blob/main/vendor/github.com/rabbitmq/amqp091-go/CONTRIBUTING.md Executes the static analysis checks using golangci-lint. Requires golangci-lint to be installed. ```shell make checks ``` -------------------------------- ### Install go-rabbitmq Library Source: https://github.com/wagslane/go-rabbitmq/blob/main/README.md Use the standard Go package manager to fetch and install the go-rabbitmq library within your Go module. ```Bash go get github.com/wagslane/go-rabbitmq ``` -------------------------------- ### Quick Start RabbitMQ Publisher in Go Source: https://github.com/wagslane/go-rabbitmq/blob/main/README.md Illustrates the process of connecting to RabbitMQ, creating a publisher, configuring it with options such as exchange declaration, and publishing a message to a specified routing key and exchange. ```Go conn, err := rabbitmq.NewConn( "amqp://guest:guest@localhost", rabbitmq.WithConnectionOptionsLogging, ) if err != nil { log.Fatal(err) } defer conn.Close() publisher, err := rabbitmq.NewPublisher( conn, rabbitmq.WithPublisherOptionsLogging, rabbitmq.WithPublisherOptionsExchangeName("events"), rabbitmq.WithPublisherOptionsExchangeDeclare, ) if err != nil { log.Fatal(err) } defer publisher.Close() err = publisher.Publish( []byte("hello, world"), []string{"my_routing_key"}, rabbitmq.WithPublishOptionsContentType("application/json"), rabbitmq.WithPublishOptionsExchange("events"), ) if err != nil { log.Println(err) } ``` -------------------------------- ### Run Integration Tests with Docker (Shell) Source: https://github.com/wagslane/go-rabbitmq/blob/main/vendor/github.com/rabbitmq/amqp091-go/CONTRIBUTING.md Runs the integration tests using a temporary RabbitMQ container managed by Docker. This target handles setting up the environment and tearing down the container. ```shell make tests-docker ``` -------------------------------- ### Run Integration Tests (Shell) Source: https://github.com/wagslane/go-rabbitmq/blob/main/vendor/github.com/rabbitmq/amqp091-go/CONTRIBUTING.md Executes the integration test suite. Requires a running RabbitMQ instance accessible via the default URL or the AMQP_URL environment variable. Some tests may require rabbitmqctl. ```shell make tests ``` -------------------------------- ### Generate Changelog Source: https://github.com/wagslane/go-rabbitmq/blob/main/vendor/github.com/rabbitmq/amqp091-go/RELEASE.md Command to generate the project changelog using `github_changelog_generator`. It requires a GitHub token and specifies the repository details, excluding unreleased changes and using the `main` branch. ```shell github_changelog_generator --token GITHUB-TOKEN -u rabbitmq -p amqp091-go --no-unreleased --release-branch main ``` -------------------------------- ### Aliasing RabbitMQ Go Client Package Source: https://github.com/wagslane/go-rabbitmq/blob/main/vendor/github.com/rabbitmq/amqp091-go/README.md This snippet demonstrates how to use a package alias when importing the amqp091-go library. Aliasing the new package path to 'amqp' helps reduce code changes when migrating from the older streadway/amqp client. ```Go amqp "github.com/rabbitmq/amqp091-go" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.