You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2017/12/16 17:00:40 UTC

[GitHub] merlimat commented on a change in pull request #962: Raw Reader for Pulsar Topics

merlimat commented on a change in pull request #962: Raw Reader for Pulsar Topics
URL: https://github.com/apache/incubator-pulsar/pull/962#discussion_r157346112
 
 

 ##########
 File path: pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawMessageImpl.java
 ##########
 @@ -0,0 +1,56 @@
+/**
+ * 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 io.netty.buffer.ByteBuf;
+import org.apache.pulsar.client.api.MessageId;
+import org.apache.pulsar.client.api.RawMessage;
+import org.apache.pulsar.common.api.proto.PulsarApi.MessageIdData;
+import org.apache.pulsar.client.impl.MessageIdImpl;
+
+public class RawMessageImpl implements RawMessage {
+    private final MessageIdData id;
+    private final ByteBuf headersAndPayload;
+
+    RawMessageImpl(MessageIdData id, ByteBuf headersAndPayload) {
+        this.id = id;
+        this.headersAndPayload = headersAndPayload.slice();
 
 Review comment:
   There is a `.retainedSlice()` method that has the same effect of `slice()` and `retain()`. The only difference with `retainedSlice()` is that it allows to recycle the sliced `ByteBuf` on release.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services