[ https://issues.apache.org/jira/browse/BEAM-702 ]


    Danny McCormick deleted comment on BEAM-702:
    --------------------------------------

was (Author: JIRAUSER282469):
This issue has been migrated to https://github.com/apache/beam/issues/17926

> Simple pattern for per-bundle and per-DoFn Closeable resources
> --------------------------------------------------------------
>
>                 Key: BEAM-702
>                 URL: https://issues.apache.org/jira/browse/BEAM-702
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-ideas
>            Reporter: Eugene Kirpichov
>            Priority: P3
>
> Dealing with Closeable resources inside a processElement call is easy: simply 
> use try-with-resources.
> However, bundle- or DoFn-scoped resources, such as long-lived database 
> connections, are less convenient to deal with: you have to open them in 
> startBundle and conditionally close in finishBundle (likewise 
> setup/teardown), taking special care if there's multiple resources to close 
> all of them.
> Perhaps we should provide something like Guava's Closer to DoFn's 
> https://github.com/google/guava/wiki/ClosingResourcesExplained. Ideally, the 
> user would need to only write a startBundle() or setup() method, but not 
> write finishBundle() or teardown() - resources would be closed automatically.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to