Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions sdks/go/examples/snippets/04transforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"reflect"
"sort"
"strings"
"time"

"github.com/apache/beam/sdks/v2/go/pkg/beam"
"github.com/apache/beam/sdks/v2/go/pkg/beam/core/typex"
Expand Down Expand Up @@ -88,6 +89,22 @@ func CreateAndSplit(s beam.Scope, input []stringPair) beam.PCollection {

// [END cogroupbykey_input_helpers]

type splittableDoFn struct{}

// [START bundlefinalization_simplecallback]

func (fn *splittableDoFn) ProcessElement(element string, bf beam.BundleFinalization) {
// ... produce output ...

bf.RegisterCallback(5*time.Minute, func() error {
// ... perform a side effect ...

return nil
})
}

// [END bundlefinalization_simplecallback]

// [START cogroupbykey_output_helpers]

func formatCoGBKResults(key string, emailIter, phoneIter func(*string) bool) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6535,7 +6535,7 @@ use case.
{{< /highlight >}}

{{< highlight go >}}
This is not supported yet, see BEAM-10976.
{{< code_sample "sdks/go/examples/snippets/04transforms.go" bundlefinalization_simplecallback >}}
{{< /highlight >}}

## 13. Multi-language pipelines {#multi-language-pipelines}
Expand Down