Skip to content

draft withOp #3254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -1493,4 +1493,20 @@ class OperatorImpl {
log.warn "Operator `fork` has been renamed to `multiMap`"
multiMap(source, action)
}

/**
* Implement a `withOp` operator e.g.
* <pre>
* someChannel | withOp { someProcess(it, someChannel) }
someChannel | withOp { someProcess(someChannel, it) }
someChannel | withOp { someChannel.someOperator(it) }
* </pre>
*
* @param source The channel instance to be bound in the context
* @param closure A closure defining the operation/process to call
*/

Object withOp(final DataflowReadChannel source, Closure closure) {
source.with(closure)
}
}