* updates

* updates

* updates

* Update version.go
This commit is contained in:
mg 2020-01-17 11:56:58 -06:00 коммит произвёл Joel Hendrix
Родитель 7a1b2e2089
Коммит 403470e620
3 изменённых файлов: 20 добавлений и 1 удалений

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

@ -2,6 +2,8 @@
## `head`
- add support for websocket connections with eph with `eph.WithWebSocketConnection()`
## `v2.0.4`
- add comment on the `PartitionID` field in `SystemProperties` to clarify that it will always return a nil value [#131](https://github.com/Azure/azure-event-hubs-go/issues/131)

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

@ -74,6 +74,7 @@ type (
handlersMu sync.Mutex
partitionIDs []string
noBanner bool
webSocketConnection bool
env *azure.Environment
}
@ -117,6 +118,14 @@ func WithEnvironment(env azure.Environment) EventProcessorHostOption {
}
}
// WithWebSocketConnection will configure an EventProcessorHost to use websockets
func WithWebSocketConnection() EventProcessorHostOption {
return func(host *EventProcessorHost) error {
host.webSocketConnection = true
return nil
}
}
// NewFromConnectionString builds a new Event Processor Host from an Event Hub connection string which can be found in
// the Azure portal
func NewFromConnectionString(ctx context.Context, connStr string, leaser Leaser, checkpointer Checkpointer, opts ...EventProcessorHostOption) (*EventProcessorHost, error) {
@ -165,6 +174,10 @@ func NewFromConnectionString(ctx context.Context, connStr string, leaser Leaser,
hubOpts = append(hubOpts, eventhub.HubWithEnvironment(*host.env))
}
if host.webSocketConnection {
hubOpts = append(hubOpts, eventhub.HubWithWebSocketConnection())
}
client, err := eventhub.NewHubFromConnectionString(connStr, hubOpts...)
if err != nil {
tab.For(ctx).Error(err)
@ -217,6 +230,10 @@ func New(ctx context.Context, namespace, hubName string, tokenProvider auth.Toke
hubOpts = append(hubOpts, eventhub.HubWithEnvironment(*host.env))
}
if host.webSocketConnection {
hubOpts = append(hubOpts, eventhub.HubWithWebSocketConnection())
}
client, err := eventhub.NewHub(namespace, hubName, tokenProvider, hubOpts...)
if err != nil {
return nil, err

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

@ -2,5 +2,5 @@ package eventhub
const (
// Version is the semantic version number
Version = "3.0.0"
Version = "3.1.0"
)