[ 
https://issues.apache.org/jira/browse/BEAM-3979?focusedWorklogId=94839&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-94839
 ]

ASF GitHub Bot logged work on BEAM-3979:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Apr/18 22:51
            Start Date: 24/Apr/18 22:51
    Worklog Time Spent: 10m 
      Work Description: kennknowles commented on a change in pull request 
#4989: [BEAM-3979] Start completing the new DoFn vision: plumb context 
parameters into process functions.
URL: https://github.com/apache/beam/pull/4989#discussion_r183902669
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFnOutputReceivers.java
 ##########
 @@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.transforms;
+
+import javax.annotation.Nullable;
+import org.apache.beam.sdk.transforms.DoFn.MultiOutputReceiver;
+import org.apache.beam.sdk.transforms.DoFn.OutputReceiver;
+import org.apache.beam.sdk.values.TupleTag;
+import org.joda.time.Instant;
+
+/**
+ * Common {@link OutputReceiver} and {@link MultiOutputReceiver} classes.
+ */
+public class DoFnOutputReceivers {
+  private static class WindowedContextOutputReceiver<T> implements 
OutputReceiver<T> {
+    DoFn<?, ?>.WindowedContext context;
+    @Nullable TupleTag<T> outputTag;
+    public WindowedContextOutputReceiver(DoFn<?, ?>.WindowedContext context,
 
 Review comment:
   One easy way to broadcast the nature of these adapters is by the good 
practice of static factory methods. This one, for example would be something 
like `outputReceiverForLegacyContext` and you might `@Deprecated`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 94839)

> New DoFn should allow injecting of all parameters in ProcessContext
> -------------------------------------------------------------------
>
>                 Key: BEAM-3979
>                 URL: https://issues.apache.org/jira/browse/BEAM-3979
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>    Affects Versions: 2.4.0
>            Reporter: Reuven Lax
>            Assignee: Reuven Lax
>            Priority: Major
>             Fix For: 2.5.0
>
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> This was intended in the past, but never completed. Ideally all primitive 
> parameters in ProcessContext should be injectable, and OutputReceiver 
> parameters can be used to collection output. So, we should be able to write a 
> DoFn as follows
> @ProcessElement
> public void process(@Element String word, OutputReceiver<String> receiver) {
>   receiver.output(word.toUpperCase());
> }



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to