Search in sources :

Example 6 with EventBusOptions

use of io.vertx.core.eventbus.EventBusOptions in project vert.x by eclipse.

the class MetricsContextTest method testFactoryInCluster.

@Test
public void testFactoryInCluster() throws Exception {
    AtomicReference<Thread> metricsThread = new AtomicReference<>();
    AtomicReference<Context> metricsContext = new AtomicReference<>();
    Thread testThread = Thread.currentThread();
    VertxMetricsFactory factory = (options) -> {
        metricsThread.set(Thread.currentThread());
        metricsContext.set(Vertx.currentContext());
        return DummyVertxMetrics.INSTANCE;
    };
    VertxOptions options = new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)).setEventBusOptions(new EventBusOptions());
    clusteredVertx(options, onSuccess(vertx -> {
        assertSame(testThread, metricsThread.get());
        assertNull(metricsContext.get());
        testComplete();
    }));
    await();
}
Also used : io.vertx.core(io.vertx.core) DatagramSocket(io.vertx.core.datagram.DatagramSocket) HttpResponse(io.vertx.core.spi.observability.HttpResponse) VertxMetricsFactory(io.vertx.core.spi.VertxMetricsFactory) HttpRequest(io.vertx.core.spi.observability.HttpRequest) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Test(org.junit.Test) DummyVertxMetrics(io.vertx.core.metrics.impl.DummyVertxMetrics) io.vertx.core.net(io.vertx.core.net) VertxTestBase(io.vertx.test.core.VertxTestBase) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) io.vertx.core.http(io.vertx.core.http) CountDownLatch(java.util.concurrent.CountDownLatch) EventBus(io.vertx.core.eventbus.EventBus) Buffer(io.vertx.core.buffer.Buffer) MetricsOptions(io.vertx.core.metrics.MetricsOptions) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) BiConsumer(java.util.function.BiConsumer) DatagramSocketOptions(io.vertx.core.datagram.DatagramSocketOptions) EventBusOptions(io.vertx.core.eventbus.EventBusOptions) MessageConsumer(io.vertx.core.eventbus.MessageConsumer) MetricsOptions(io.vertx.core.metrics.MetricsOptions) AtomicReference(java.util.concurrent.atomic.AtomicReference) EventBusOptions(io.vertx.core.eventbus.EventBusOptions) VertxMetricsFactory(io.vertx.core.spi.VertxMetricsFactory) Test(org.junit.Test)

Aggregations

EventBusOptions (io.vertx.core.eventbus.EventBusOptions)6 Vertx (io.vertx.core.Vertx)3 EventBus (io.vertx.core.eventbus.EventBus)3 VertxOptions (io.vertx.core.VertxOptions)2 Buffer (io.vertx.core.buffer.Buffer)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 io.vertx.core (io.vertx.core)1 AsyncResult (io.vertx.core.AsyncResult)1 Promise (io.vertx.core.Promise)1 DatagramSocket (io.vertx.core.datagram.DatagramSocket)1 DatagramSocketOptions (io.vertx.core.datagram.DatagramSocketOptions)1 MessageConsumer (io.vertx.core.eventbus.MessageConsumer)1 OutboundDeliveryContext (io.vertx.core.eventbus.impl.OutboundDeliveryContext)1 PingMessageCodec (io.vertx.core.eventbus.impl.codecs.PingMessageCodec)1 io.vertx.core.http (io.vertx.core.http)1 VertxBuilder (io.vertx.core.impl.VertxBuilder)1 VertxInternal (io.vertx.core.impl.VertxInternal)1 Logger (io.vertx.core.impl.logging.Logger)1 LoggerFactory (io.vertx.core.impl.logging.LoggerFactory)1