[GitHub] sijie commented on a change in pull request #1636: Rename Connect `Message` interface to `Record`

2018-04-24 Thread GitBox
sijie commented on a change in pull request #1636:  Rename Connect `Message` 
interface to `Record`
URL: https://github.com/apache/incubator-pulsar/pull/1636#discussion_r183625515
 
 

 ##
 File path: 
pulsar-connect/core/src/main/java/org/apache/pulsar/connect/core/Sink.java
 ##
 @@ -42,8 +42,8 @@
 /**
  * Attempt to publish a type safe collection of messages
  *
- * @param message Object to publish to the sink
+ * @param outputValue output value
  * @return Completable future fo async publish request
  */
-CompletableFuture write(final Message message);
+CompletableFuture write(T outputValue);
 
 Review comment:
   @jerrypeng I think in your pull request, this method will become 
`write(Record inputRecord, T outputValue)`, no? In this case, T is the 
result after processing `inputRecord`. at this moment, we have no idea about 
which partition, what sequence id we want to write for the result, no?


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


With regards,
Apache Git Services


[GitHub] sijie commented on a change in pull request #1636: Rename Connect `Message` interface to `Record`

2018-04-24 Thread GitBox
sijie commented on a change in pull request #1636:  Rename Connect `Message` 
interface to `Record`
URL: https://github.com/apache/incubator-pulsar/pull/1636#discussion_r183625045
 
 

 ##
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageRecordImpl.java
 ##
 @@ -0,0 +1,49 @@
+/**
+ * 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.pulsar.client.impl;
+
+import org.apache.pulsar.client.api.Consumer;
+import org.apache.pulsar.client.api.Message;
+import org.apache.pulsar.client.api.MessageId;
+import org.apache.pulsar.connect.core.Record;
+
+/**
+ * Abstract class that implements message api and connect record api.
+ */
+public abstract class MessageRecordImpl implements 
Message, Record {
+
+protected M messageId;
+private Consumer consumer;
+
+public void setConsumer(Consumer consumer) {
+this.consumer = consumer;
+}
+
+@Override
+public void ack() {
+if (null != consumer && null != messageId) {
+consumer.acknowledgeAsync(messageId);
 
 Review comment:
   that works for me. 
   
   @merlimat @rdhabalia @srkukarni is that okay for you guys?


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


With regards,
Apache Git Services


[GitHub] sijie commented on a change in pull request #1636: Rename Connect `Message` interface to `Record`

2018-04-23 Thread GitBox
sijie commented on a change in pull request #1636:  Rename Connect `Message` 
interface to `Record`
URL: https://github.com/apache/incubator-pulsar/pull/1636#discussion_r183609303
 
 

 ##
 File path: 
pulsar-connect/core/src/main/java/org/apache/pulsar/connect/core/Sink.java
 ##
 @@ -42,8 +42,8 @@
 /**
  * Attempt to publish a type safe collection of messages
  *
- * @param message Object to publish to the sink
+ * @param outputValue output value
  * @return Completable future fo async publish request
  */
-CompletableFuture write(final Message message);
+CompletableFuture write(T outputValue);
 
 Review comment:
   Record should be something from source only. T is the value passed on to the 
sink, sink can convert it to the format that it can use to write.


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


With regards,
Apache Git Services


[GitHub] sijie commented on a change in pull request #1636: Rename Connect `Message` interface to `Record`

2018-04-23 Thread GitBox
sijie commented on a change in pull request #1636:  Rename Connect `Message` 
interface to `Record`
URL: https://github.com/apache/incubator-pulsar/pull/1636#discussion_r183609200
 
 

 ##
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageRecordImpl.java
 ##
 @@ -0,0 +1,49 @@
+/**
+ * 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.pulsar.client.impl;
+
+import org.apache.pulsar.client.api.Consumer;
+import org.apache.pulsar.client.api.Message;
+import org.apache.pulsar.client.api.MessageId;
+import org.apache.pulsar.connect.core.Record;
+
+/**
+ * Abstract class that implements message api and connect record api.
+ */
+public abstract class MessageRecordImpl implements 
Message, Record {
+
+protected M messageId;
+private Consumer consumer;
+
+public void setConsumer(Consumer consumer) {
+this.consumer = consumer;
+}
+
+@Override
+public void ack() {
+if (null != consumer && null != messageId) {
+consumer.acknowledgeAsync(messageId);
 
 Review comment:
   good question. I think for effectively-once, we might have to wrap in 
another object, so I leave the default behavior here for 
at-least-once/at-most-once.
   
   or do you have any other suggestions?


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


With regards,
Apache Git Services