AbstractHashMessage implementations represent aggregate message,
+ * which use to aggregate metric.
+ *
+ *
+ * @author peng-yongsheng
+ * @since v3.0-2017
+ */
+public abstract class AbstractHashMessage {
+ private int hashCode;
+
+ public AbstractHashMessage(String key) {
+ this.hashCode = key.hashCode();
+ }
+
+ public int getHashCode() {
+ return hashCode;
+ }
+}
diff --git a/apm-collector/apm-collector-remote/collector-remote-define/src/main/java/org/skywalking/apm/collector/remote/service/Data.java b/apm-collector/apm-collector-remote/collector-remote-define/src/main/java/org/skywalking/apm/collector/remote/service/Data.java
new file mode 100644
index 000000000..7f16d3eb0
--- /dev/null
+++ b/apm-collector/apm-collector-remote/collector-remote-define/src/main/java/org/skywalking/apm/collector/remote/service/Data.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2017, OpenSkywalking Organization All rights reserved.
+ *
+ * Licensed 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.
+ *
+ * Project repository: https://github.com/OpenSkywalking/skywalking
+ */
+
+package org.skywalking.apm.collector.remote.service;
+
+/**
+ * @author peng-yongsheng
+ */
+public class Data extends AbstractHashMessage {
+ private String[] dataStrings;
+ private Long[] dataLongs;
+ private Double[] dataDoubles;
+ private Integer[] dataIntegers;
+ private Boolean[] dataBooleans;
+ private byte[][] dataBytes;
+
+ public Data(String id, int stringCapacity, int longCapacity, int doubleCapacity, int integerCapacity,
+ int booleanCapacity, int byteCapacity) {
+ super(id);
+ this.dataStrings = new String[stringCapacity];
+ this.dataStrings[0] = id;
+ this.dataLongs = new Long[longCapacity];
+ this.dataDoubles = new Double[doubleCapacity];
+ this.dataIntegers = new Integer[integerCapacity];
+ this.dataBooleans = new Boolean[booleanCapacity];
+ this.dataBytes = new byte[byteCapacity][];
+ }
+
+ public void setDataString(int position, String value) {
+ dataStrings[position] = value;
+ }
+
+ public void setDataLong(int position, Long value) {
+ dataLongs[position] = value;
+ }
+
+ public void setDataDouble(int position, Double value) {
+ dataDoubles[position] = value;
+ }
+
+ public void setDataInteger(int position, Integer value) {
+ dataIntegers[position] = value;
+ }
+
+ public void setDataBoolean(int position, Boolean value) {
+ dataBooleans[position] = value;
+ }
+
+ public void setDataBytes(int position, byte[] dataBytes) {
+ this.dataBytes[position] = dataBytes;
+ }
+
+ public String getDataString(int position) {
+ return dataStrings[position];
+ }
+
+ public Long getDataLong(int position) {
+ return dataLongs[position];
+ }
+
+ public Double getDataDouble(int position) {
+ return dataDoubles[position];
+ }
+
+ public Integer getDataInteger(int position) {
+ return dataIntegers[position];
+ }
+
+ public Boolean getDataBoolean(int position) {
+ return dataBooleans[position];
+ }
+
+ public byte[] getDataBytes(int position) {
+ return dataBytes[position];
+ }
+
+ public String id() {
+ return dataStrings[0];
+ }
+
+ @Override public String toString() {
+ StringBuilder dataStr = new StringBuilder();
+ dataStr.append("string: [");
+ for (int i = 0; i < dataStrings.length; i++) {
+ dataStr.append(dataStrings[i]).append(",");
+ }
+ dataStr.append("], longs: [");
+ for (int i = 0; i < dataLongs.length; i++) {
+ dataStr.append(dataLongs[i]).append(",");
+ }
+ dataStr.append("], double: [");
+ for (int i = 0; i < dataDoubles.length; i++) {
+ dataStr.append(dataDoubles[i]).append(",");
+ }
+ dataStr.append("], integer: [");
+ for (int i = 0; i < dataIntegers.length; i++) {
+ dataStr.append(dataIntegers[i]).append(",");
+ }
+ dataStr.append("], boolean: [");
+ for (int i = 0; i < dataBooleans.length; i++) {
+ dataStr.append(dataBooleans[i]).append(",");
+ }
+ return dataStr.toString();
+ }
+}
diff --git a/apm-collector/apm-collector-remote/collector-remote-define/src/main/java/org/skywalking/apm/collector/remote/service/DataReceiver.java b/apm-collector/apm-collector-remote/collector-remote-define/src/main/java/org/skywalking/apm/collector/remote/service/DataReceiver.java
new file mode 100644
index 000000000..16a09d65d
--- /dev/null
+++ b/apm-collector/apm-collector-remote/collector-remote-define/src/main/java/org/skywalking/apm/collector/remote/service/DataReceiver.java
@@ -0,0 +1,8 @@
+package org.skywalking.apm.collector.remote.service;
+
+/**
+ * @author peng-yongsheng
+ */
+public interface DataReceiver {
+ void receive(Data data);
+}
diff --git a/apm-collector/apm-collector-remote/collector-remote-define/src/main/java/org/skywalking/apm/collector/remote/service/DataService.java b/apm-collector/apm-collector-remote/collector-remote-define/src/main/java/org/skywalking/apm/collector/remote/service/DataService.java
new file mode 100644
index 000000000..e5073e985
--- /dev/null
+++ b/apm-collector/apm-collector-remote/collector-remote-define/src/main/java/org/skywalking/apm/collector/remote/service/DataService.java
@@ -0,0 +1,12 @@
+package org.skywalking.apm.collector.remote.service;
+
+import org.skywalking.apm.collector.core.module.Service;
+
+/**
+ * @author peng-yongsheng
+ */
+public interface DataService extends Service {
+ void send(Data data);
+
+ void registerReceiver(DataReceiver receiver);
+}
diff --git a/apm-collector/apm-collector-remote/collector-remote-define/src/main/resources/META-INF/services/org.skywalking.apm.collector.core.module.Module b/apm-collector/apm-collector-remote/collector-remote-define/src/main/resources/META-INF/services/org.skywalking.apm.collector.core.module.Module
new file mode 100644
index 000000000..46bd0573e
--- /dev/null
+++ b/apm-collector/apm-collector-remote/collector-remote-define/src/main/resources/META-INF/services/org.skywalking.apm.collector.core.module.Module
@@ -0,0 +1,19 @@
+#
+# Copyright 2017, OpenSkywalking Organization All rights reserved.
+#
+# Licensed 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.
+#
+# Project repository: https://github.com/OpenSkywalking/skywalking
+#
+
+org.skywalking.apm.collector.remote.RemoteModule
\ No newline at end of file
diff --git a/apm-collector/apm-collector-remote/collector-remote-grpc-define/pom.xml b/apm-collector/apm-collector-remote/collector-remote-grpc-define/pom.xml
new file mode 100644
index 000000000..926be29de
--- /dev/null
+++ b/apm-collector/apm-collector-remote/collector-remote-grpc-define/pom.xml
@@ -0,0 +1,22 @@
+
+