Golang library for Azure Service Bus -- https://aka.ms/azsb
Перейти к файлу
David Justice b633a2d5a4
basic readme info and quick start example
2018-05-09 10:07:46 -07:00
_examples basic readme info and quick start example 2018-05-09 10:07:46 -07:00
internal/test queue management requests functioning 2018-05-03 20:03:07 -07:00
.gitignore initial commit for the service bus go sdk 2018-01-10 17:55:33 -08:00
.travis.yml add coverage and change test debugging 2018-01-30 09:37:55 -08:00
Gopkg.lock update amqp common dep 2018-05-09 09:17:10 -07:00
Gopkg.toml update amqp common dep 2018-05-09 09:17:10 -07:00
LICENSE Initial commit 2018-01-10 10:23:46 -08:00
Makefile queue management requests functioning 2018-05-03 20:03:07 -07:00
README.md basic readme info and quick start example 2018-05-09 10:07:46 -07:00
event.go subscription and topics can send and receive 2018-05-09 09:17:10 -07:00
mgmt.go subscription and topics can send and receive 2018-05-09 09:17:10 -07:00
mgmt_test.go topics management and sending to topic is working 2018-05-09 09:16:39 -07:00
namespace.go queue management requests functioning 2018-05-03 20:03:07 -07:00
namespace_test.go queue management requests functioning 2018-05-03 20:03:07 -07:00
queue.go subscription and topics can send and receive 2018-05-09 09:17:10 -07:00
queue_test.go subscription and topics can send and receive 2018-05-09 09:17:10 -07:00
receiver.go subscription and topics can send and receive 2018-05-09 09:17:10 -07:00
sender.go topics management and sending to topic is working 2018-05-09 09:16:39 -07:00
session.go queue management requests functioning 2018-05-03 20:03:07 -07:00
subscription.go update amqp common dep 2018-05-09 09:17:10 -07:00
subscription_test.go subscription and topics can send and receive 2018-05-09 09:17:10 -07:00
topic.go subscription and topics can send and receive 2018-05-09 09:17:10 -07:00
topic_test.go subscription and topics can send and receive 2018-05-09 09:17:10 -07:00
tracing.go queue management requests functioning 2018-05-03 20:03:07 -07:00

README.md

Microsoft Azure Service Bus Client for Golang

Microsoft Azure Service Bus is a reliable cloud messaging service (MaaS) which simplifies enterprise cloud messaging. It enables developers to build scalable cloud solutions and implement complex messaging workflows over an efficient binary protocol called AMQP.

This library provides a simple interface for sending, receiving and managing Service Bus entities such as Queues, Topics and Subscriptions.

For more information about Service Bus, check out the Azure documentation.

This library is a pure Golang implementation of Azure Event Hubs over AMQP.

Preview of Service Bus for Golang

This library is currently a preview. There may be breaking interface changes until it reaches semantic version v1.0.0. If you run into an issue, please don't hesitate to log a new issue or open a pull request.

Installing the library

To more reliably manage dependencies in your application we recommend golang/dep.

With dep:

dep ensure -add github.com/Azure/azure-service-bus-go

With go get:

go get -u github.com/Azure/azure-service-bus-go/...

If you need to install Go, follow the official instructions

Using Service Bus

In this section we'll cover some basics of the library to help you get started.

This library has two main dependencies, vcabbage/amqp and Azure AMQP Common. The former provides the AMQP protocol implementation and the latter provides some common authentication, persistence and request-response message flows.

Quick start

Let's send and receive "hello, world!".

// Connect
connStr := mustGetenv("SERVICEBUS_CONNECTION_STRING")
ns, err := servicebus.NewNamespace(servicebus.NamespaceWithConnectionString(connStr))
handleErr(err)

queueName := "helloworld"
// Create the queue if it doesn't exist
qm := ns.NewQueueManager()
_, err := qm.Put(context.Background(), queueName)
handleErr(err)
q := ns.NewQueue(queueName)

// Send message to queue
err := q.Send(context.Background(), servicebus.NewEventFromString("Hello World!"))
handleErr(err)

// Receive message from queue
listenHandle, err := q.Receive(context.Background())
defer listenHandle.Close(context.Background)
handleErr(err)

// Wait for a signal to quit:
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt, os.Kill)
<-signalChan

Examples

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.