Documentation ¶
Overview ¶
Example (EventHubs) ¶
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second) // defer goes in LIFO order defer cancel() defer resources.Cleanup(context.Background()) // cleanup can take a long time // create group var err error var groupName = config.GenerateGroupName("EventHubs") config.SetGroupName(groupName) _, err = resources.CreateGroup(ctx, config.GroupName()) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created group") // create Event Hubs namespace _, err = CreateNamespace(ctx, nsName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created namespace") // create Event Hubs hub _, err = CreateHub(ctx, nsName, hubName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created hub") // send and receive messages log.Printf("Send(ctx)\n") Send(ctx, nsName, hubName) log.Printf("Receive(ctx)\n") Receive(ctx, nsName, hubName) log.Printf("ReceiveViaEPH(ctx)\n") ReceiveViaEPH(ctx, nsName, hubName, storageAccountName, storageContainerName)
Output: created group created namespace created hub received: test-message received: test-message
Index ¶
- func CreateHub(ctx context.Context, nsName string, hubName string) (eventhub.Model, error)
- func CreateNamespace(ctx context.Context, nsName string) (*eventhub.EHNamespace, error)
- func Receive(ctx context.Context, nsName, hubName string)
- func ReceiveViaEPH(ctx context.Context, ...)
- func Send(ctx context.Context, nsName, hubName string)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNamespace ¶
CreateNamespace creates an Event Hubs namespace
func ReceiveViaEPH ¶
func ReceiveViaEPH(ctx context.Context, nsName, hubName, storageAccountName, storageContainerName string)
ReceiveViaEPH sets up an Event Processor Host (EPH), a small framework to receive events from several partitions.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.