Skip to content

Commit

Permalink
Merge branch 'master' into fix_test
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinfish committed Aug 14, 2019
2 parents 8d3dfb5 + 22ceed5 commit 5df404b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions readme.md
Expand Up @@ -228,15 +228,18 @@ particular partition. You can do this in two ways.
```

#### Sending batches of events
Sending a batch of messages is more efficient than sending a single message.
Sending a batch of messages is more efficient than sending a single message. `SendBatch` takes an `*EventBatchIterator` that will automatically create batches from a slice of `*Event`.
```go
batch := &EventBatch{
Events: []*eventhub.Event {
eventhub.NewEventFromString("one"),
eventhub.NewEventFromString("two"),
},
}
err := client.SendBatch(ctx, batch)
import (
eventhub "github.com/Azure/azure-event-hubs-go/v2"
)
...
var events []*eventhub.Event
events = append(events, eventhub.NewEventFromString("one"))
events = append(events, eventhub.NewEventFromString("two"))
events = append(events, eventhub.NewEventFromString("three"))

err := client.SendBatch(ctx, eventhub.NewEventBatchIterator(events...))
```

#### Receiving
Expand Down

0 comments on commit 5df404b

Please sign in to comment.