-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Scott Nichols <snichols@vmware.com>
- Loading branch information
Scott Nichols
committed
Mar 16, 2020
1 parent
e5f85d9
commit 938649b
Showing
8 changed files
with
127 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/cloudevents/sdk-go/pkg/client" | ||
"log" | ||
|
||
cloudevents "github.com/cloudevents/sdk-go" | ||
) | ||
|
||
func main() { | ||
ctx := context.Background() | ||
p, err := cloudevents.NewHTTP() | ||
if err != nil { | ||
log.Fatalf("failed to create protocol: %s", err.Error()) | ||
} | ||
|
||
c, err := cloudevents.NewClient(p) | ||
if err != nil { | ||
log.Fatalf("failed to create client, %v", err) | ||
} | ||
|
||
log.Printf("will listen on :8080\n") | ||
log.Fatalf("failed to start receiver: %s", c.StartReceiver(ctx, receive)) | ||
} | ||
|
||
func receive(ctx context.Context, e cloudevents.Event) { | ||
ctx, span := client.TraceSpan(ctx, e) | ||
defer span.End() | ||
|
||
fmt.Printf("%s", e) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters