Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
Merge 3417ed9 into 6acd130
Browse files Browse the repository at this point in the history
  • Loading branch information
vcabbage committed Jan 12, 2018
2 parents 6acd130 + 3417ed9 commit d559c7f
Show file tree
Hide file tree
Showing 142 changed files with 2,278 additions and 362 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ amqp.test
*.log
/cmd
cover.out
.envrc
recordings
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go
sudo: false
go:
- 1.7.x
- 1.8.x
- 1.x
- tip
go_import_path: pack.ag/amqp
Expand All @@ -11,7 +11,7 @@ matrix:
before_install:
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
- go get -t -v -d -tags gofuzz ./...
- go get -t -v -d -tags "integration gofuzz" ./...
script:
- make coverage
- goveralls -coverprofile=cover.out -service=travis-ci
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# pack.ag/amqp Changelog

### 0.2.0

#### Summary

* Support for sending messages.
* Support for sending/receiving "value" payloads.
* Added option `LinkAddressDynamic()`, `Sender.Address()` and `Receiver.Address()` to support dynamic addresses.
* Added options `LinkSenderSettle()` and `LinkReceiverSettle()` to allow for configuring settlement modes.
* Added option `ConnSASLAnonymous()` to enable SASL ANONYMOUS authentication.
* UUID support.
* Added basic integration tests against Microsoft Azure Service Bus.
* Debug logging when built with `debug` build tag.
* Many bug fixes.

#### Breaking Changes

* Option `LinkSource()` renamed to `LinkAddress()`.
* As they are optional, `Message.Header` and `Message.Properties` have been changed to pointers.

### 0.1.0

* Initial release
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,24 @@ FUZZ_DIR := ./fuzz

all: test

.PHONY: fuzzconn
fuzzconn:
go-fuzz-build -o $(FUZZ_DIR)/conn.zip -func FuzzConn $(PACKAGE)
go-fuzz -bin $(FUZZ_DIR)/conn.zip -workdir $(FUZZ_DIR)/conn

.PHONE: fuzzmarshal
fuzzmarshal:
go-fuzz-build -o $(FUZZ_DIR)/marshal.zip -func FuzzUnmarshal $(PACKAGE)
go-fuzz -bin $(FUZZ_DIR)/marshal.zip -workdir $(FUZZ_DIR)/marshal

.PHONY: fuzzclean
fuzzclean:
rm -f $(FUZZ_DIR)/**/{crashers,suppressions}/*
rm -f $(FUZZ_DIR)/*.zip

.PHONY: test
test:
TEST_CORPUS=1 go test -tags gofuzz -race -run=Corpus
go test -tags gofuzz -v -race ./...

.PHONY: coverage
integration:
go test -tags "integration pkgerrors" -v -race ./...

coverage:
TEST_CORPUS=1 go test -tags gofuzz -cover -coverprofile=cover.out -v
TEST_CORPUS=1 go test -tags "integration gofuzz" -cover -coverprofile=cover.out -v
72 changes: 49 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
[![GoDoc](https://godoc.org/pack.ag/amqp?status.svg)](http://godoc.org/pack.ag/amqp)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/vcabbage/amqp/master/LICENSE)


pack.ag/amqp is an AMQP 1.0 client implementation for Go.

AMQP 1.0 is not compatible with AMQP 0-9-1 or 0-10, which are
the most common AMQP protocols in use today.

This project is currently alpha status, though is currently being used by my employer
in a pre-production capacity. The current focus is reading from
Microsoft Azure's Service Bus. Only receive operations have been implemented.
Producer operations will be implemented later.
in a pre-production capacity. The current focus is reading from Microsoft Azure's Service Bus.

API is subject to change until 1.0.0. If you choose to use this library, please vendor it.

Expand Down Expand Up @@ -57,29 +54,58 @@ func main() {
log.Fatal("Creating AMQP session:", err)
}

// Create a receiver
receiver, err := session.NewReceiver(
amqp.LinkSource("/queue-name"),
amqp.LinkCredit(10),
)
if err != nil {
log.Fatal("Creating receiver link:", err)
}
ctx := context.Background()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// Send a message
{
// Create a sender
sender, err := session.NewSender(
amqp.LinkAddress("/queue-name"),
)
if err != nil {
log.Fatal("Creating sender link:", err)
}

for {
// Receive next message
msg, err := receiver.Receive(ctx)
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)

// Send message
err = sender.Send(ctx, &amqp.Message{
Data: []byte("Hello!"),
})
if err != nil {
log.Fatal("Reading message from AMQP:", err)
log.Fatal("Sending message:", err)
}

// Accept message
msg.Accept()
cancel()
sender.Close()
}

fmt.Printf("Message received: %s\n", msg.Data)
// Continuously read messages
{
// Create a receiver
receiver, err := session.NewReceiver(
amqp.LinkAddress("/queue-name"),
amqp.LinkCredit(10),
)
if err != nil {
log.Fatal("Creating receiver link:", err)
}

ctx, cancel := context.WithCancel(ctx)
defer cancel()

for {
// Receive next message
msg, err := receiver.Receive(ctx)
if err != nil {
log.Fatal("Reading message from AMQP:", err)
}

// Accept message
msg.Accept()

fmt.Printf("Message received: %s\n", msg.Data)
}
}
}
```
Expand All @@ -89,15 +115,15 @@ func main() {
### Notable Bugs/Shortcomings

- [ ] Closing a sessions does not send an end performative.
- [ ] Testing is lacking. Only fuzz testing is currently being performed.
- [ ] Testing should be improved. Currently fuzz testing and basic Azure Service Bus integration testing is being performed.

### Features - Short Term

- [ ] Set sender filters to support Azure Event Hubs.

### Features - Medium Term

- [ ] Support message producer operations.
- [X] Support message producer operations. (Supported as of 0.2.0)

### Other Notes

Expand Down
Loading

0 comments on commit d559c7f

Please sign in to comment.