add package name to batch example

This commit is contained in:
Bryan Lewis 2019-08-09 00:05:14 -06:00
Родитель 007bb69a6e
Коммит 3945c29014
1 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -230,12 +230,16 @@ particular partition. You can do this in two ways.
#### Sending batches of events #### Sending batches of events
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`. 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 ```go
var events []*Event import (
events = append(events, NewEventFromString("one")) eventhub "github.com/Azure/azure-event-hubs-go/v2"
events = append(events, NewEventFromString("two")) )
events = append(events, NewEventFromString("three")) ...
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, NewEventBatchIterator(events...)) err := client.SendBatch(ctx, eventhub.NewEventBatchIterator(events...))
``` ```
#### Receiving #### Receiving