Package zipkin2.reporter.amqp
Class RabbitMQSender
- java.lang.Object
-
- zipkin2.Component
-
- zipkin2.reporter.Sender
-
- zipkin2.reporter.amqp.RabbitMQSender
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public final class RabbitMQSender extends Sender
This sends (usually json v2) encoded spans to a RabbitMQ queue.Usage
This type is designed forthe async reporter.Here's a simple configuration, configured for json:
sender = RabbitMQSender.create("localhost:5672");Here's an example with an explicit SSL connection factory and protocol buffers encoding:
connectionFactory = new ConnectionFactory(); connectionFactory.setHost("localhost"); connectionFactory.setPort(5671); connectionFactory.useSslProtocol(); sender = RabbitMQSender.newBuilder() .connectionFactory(connectionFactory) .encoding(Encoding.PROTO3) .build();Compatibility with Zipkin Server
Zipkin server should be v2.1 or higher.Implementation Notes
The sender does not use RabbitMQ Publisher Confirms, so messages considered sent may not necessarily be received by consumers in case of RabbitMQ failure.
This sender is thread-safe: a channel is created for each thread that calls
sendSpans(List).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRabbitMQSender.BuilderConfiguration including defaults needed to send spans to a RabbitMQ queue.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description zipkin2.CheckResultcheck()Ensures there are no connection issues.voidclose()static RabbitMQSendercreate(String addresses)Creates a sender that sendsEncoding.JSONmessages.zipkin2.codec.Encodingencoding()intmessageMaxBytes()intmessageSizeInBytes(int encodedSizeInBytes)intmessageSizeInBytes(List<byte[]> encodedSpans)static RabbitMQSender.BuildernewBuilder()zipkin2.Call<Void>sendSpans(List<byte[]> encodedSpans)This sends all of the spans as a single message.RabbitMQSender.BuildertoBuilder()StringtoString()
-
-
-
Method Detail
-
create
public static RabbitMQSender create(String addresses)
Creates a sender that sendsEncoding.JSONmessages.
-
newBuilder
public static RabbitMQSender.Builder newBuilder()
-
toBuilder
public final RabbitMQSender.Builder toBuilder()
-
messageMaxBytes
public int messageMaxBytes()
- Specified by:
messageMaxBytesin classSender
-
messageSizeInBytes
public int messageSizeInBytes(List<byte[]> encodedSpans)
- Specified by:
messageSizeInBytesin classSender
-
messageSizeInBytes
public int messageSizeInBytes(int encodedSizeInBytes)
- Overrides:
messageSizeInBytesin classSender
-
sendSpans
public zipkin2.Call<Void> sendSpans(List<byte[]> encodedSpans)
This sends all of the spans as a single message.
-
check
public zipkin2.CheckResult check()
Ensures there are no connection issues.- Overrides:
checkin classzipkin2.Component
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classzipkin2.Component- Throws:
IOException
-
-