Skip to content

Commit f391af3

Browse files
committed
remove vertx dependency
1 parent 94ed89b commit f391af3

File tree

8 files changed

+38
-759
lines changed

8 files changed

+38
-759
lines changed

pom.xml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
<guice.version>4.0</guice.version>
119119
<hamcrest.version>2.0.0.0</hamcrest.version>
120120
<hikari.version>2.5.1</hikari.version>
121+
<asynchttpclient.version>2.0.11</asynchttpclient.version>
121122
<h2.version>1.4.190</h2.version>
122123
<jackson.version>2.8.5</jackson.version>
123124
<javassist.version>3.21.0-GA</javassist.version>
@@ -152,7 +153,6 @@
152153
<slf4j.version>1.7.22</slf4j.version>
153154
<signalfx.protoc.version>0.0.23</signalfx.protoc.version>
154155
<typesafe.config.version>1.3.1</typesafe.config.version>
155-
<vertx.core.version>2.1.6</vertx.core.version>
156156
<wavefront.version>3.20</wavefront.version>
157157
<wiremock.version>1.57</wiremock.version>
158158

@@ -715,30 +715,15 @@
715715
<version>${commons.codec.version}</version>
716716
</dependency>
717717
<dependency>
718-
<groupId>io.netty</groupId>
719-
<artifactId>netty-all</artifactId>
720-
<version>${netty.all.version}</version>
721-
</dependency>
722-
<dependency>
723-
<groupId>com.ning</groupId>
718+
<groupId>org.asynchttpclient</groupId>
724719
<artifactId>async-http-client</artifactId>
725-
<version>${ning.http.client.version}</version>
726-
</dependency>
727-
<dependency>
728-
<groupId>com.typesafe.play</groupId>
729-
<artifactId>play_${scala.version}</artifactId>
730-
<version>${play.version}</version>
720+
<version>${asynchttpclient.version}</version>
731721
</dependency>
732722
<dependency>
733723
<groupId>com.typesafe.play</groupId>
734724
<artifactId>play-java-ws_${scala.version}</artifactId>
735725
<version>${play.version}</version>
736726
</dependency>
737-
<dependency>
738-
<groupId>io.vertx</groupId>
739-
<artifactId>vertx-core</artifactId>
740-
<version>${vertx.core.version}</version>
741-
</dependency>
742727
<dependency>
743728
<groupId>org.apache.httpcomponents</groupId>
744729
<artifactId>httpclient</artifactId>

src/main/java/com/arpnetworking/tsdcore/model/AggregationMessage.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717

1818
import akka.util.ByteIterator;
1919
import akka.util.ByteString;
20+
import akka.util.ByteStringBuilder;
2021
import com.arpnetworking.metrics.aggregation.protocol.Messages;
2122
import com.google.protobuf.GeneratedMessageV3;
2223
import com.google.protobuf.InvalidProtocolBufferException;
2324
import org.apache.commons.codec.binary.Hex;
2425
import org.slf4j.Logger;
2526
import org.slf4j.LoggerFactory;
26-
import org.vertx.java.core.buffer.Buffer;
2727

28+
import java.io.IOException;
2829
import java.nio.ByteOrder;
2930
import java.util.Optional;
3031

@@ -132,27 +133,31 @@ private static boolean typeHasSubtype(final byte type) {
132133
*
133134
* @return <code>Buffer</code> containing serialized message.
134135
*/
135-
public Buffer serialize() {
136-
final Buffer b = new Buffer();
137-
b.appendInt(0);
136+
public ByteString serialize() {
137+
final ByteStringBuilder b = ByteString.createBuilder();
138138
if (_message instanceof Messages.HostIdentification) {
139-
b.appendByte((byte) 0x01);
139+
b.putByte((byte) 0x01);
140140
} else if (_message instanceof Messages.HeartbeatRecord) {
141-
b.appendByte((byte) 0x03);
141+
b.putByte((byte) 0x03);
142142
} else if (_message instanceof Messages.StatisticSetRecord) {
143-
b.appendByte((byte) 0x04);
143+
b.putByte((byte) 0x04);
144144
} else if (_message instanceof Messages.SamplesSupportingData) {
145-
b.appendByte((byte) 0x05);
146-
b.appendByte((byte) 0x01);
145+
b.putByte((byte) 0x05);
146+
b.putByte((byte) 0x01);
147147
} else if (_message instanceof Messages.SparseHistogramSupportingData) {
148-
b.appendByte((byte) 0x05);
149-
b.appendByte((byte) 0x02);
148+
b.putByte((byte) 0x05);
149+
b.putByte((byte) 0x02);
150150
} else {
151151
throw new IllegalArgumentException(String.format("Unsupported message; message=%s", _message));
152152
}
153-
b.appendBytes(_message.toByteArray());
154-
b.setInt(0, b.length());
155-
return b;
153+
try {
154+
_message.writeTo(b.asOutputStream());
155+
} catch (final IOException e) {
156+
throw new RuntimeException(e);
157+
}
158+
final ByteStringBuilder sizePrefix = ByteString.createBuilder();
159+
sizePrefix.putInt(b.length() + INTEGER_SIZE_IN_BYTES, ByteOrder.BIG_ENDIAN);
160+
return sizePrefix.result().concat(b.result());
156161
}
157162

158163
public GeneratedMessageV3 getMessage() {

src/main/java/com/arpnetworking/tsdcore/sinks/CarbonSink.java

Lines changed: 0 additions & 93 deletions
This file was deleted.

src/main/java/com/arpnetworking/tsdcore/sinks/HttpSinkActor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import akka.actor.Props;
1919
import akka.actor.UntypedActor;
20+
import akka.http.javadsl.model.StatusCodes;
2021
import akka.pattern.PatternsCS;
2122
import com.arpnetworking.logback.annotations.LogValue;
2223
import com.arpnetworking.steno.LogValueMapFactory;
@@ -26,7 +27,6 @@
2627
import com.google.common.base.Charsets;
2728
import com.google.common.collect.EvictingQueue;
2829
import com.google.common.collect.Sets;
29-
import io.netty.handler.codec.http.HttpResponseStatus;
3030
import org.asynchttpclient.AsyncCompletionHandler;
3131
import org.asynchttpclient.AsyncHttpClient;
3232
import org.asynchttpclient.Request;
@@ -291,10 +291,10 @@ public void postStop() throws Exception {
291291

292292
static {
293293
// TODO(vkoskela): Make accepted status codes configurable [AINT-682]
294-
ACCEPTED_STATUS_CODES.add(HttpResponseStatus.OK.code());
295-
ACCEPTED_STATUS_CODES.add(HttpResponseStatus.CREATED.code());
296-
ACCEPTED_STATUS_CODES.add(HttpResponseStatus.ACCEPTED.code());
297-
ACCEPTED_STATUS_CODES.add(HttpResponseStatus.NO_CONTENT.code());
294+
ACCEPTED_STATUS_CODES.add(StatusCodes.OK.intValue());
295+
ACCEPTED_STATUS_CODES.add(StatusCodes.CREATED.intValue());
296+
ACCEPTED_STATUS_CODES.add(StatusCodes.ACCEPTED.intValue());
297+
ACCEPTED_STATUS_CODES.add(StatusCodes.NO_CONTENT.intValue());
298298
}
299299

300300
/**

0 commit comments

Comments
 (0)