Search in sources :

Example 21 with EventBus

use of io.vertx.core.eventbus.EventBus in project Summer by yale8848.

the class DXHResource method dxh.

@Path("/dxh/{dxhv}")
@GET
public void dxh(@PathParam("dxhv") String dxh, @Context Vertx vertx, @Context HttpServerResponse response) {
    dxh = "8454005";
    // WebClient client = WebClient.create(vertx);
    // HttpUtils.oneDXH(client,response,dxh,vertx);
    // response.end(dxh);
    /*      try {
            EventBus eb = vertx.eventBus();
            EventMessage eventMessage=EventMessage.message(null);
            eventMessage.setKey("68257");
            Message<EventMessage> reply = awaitResult(h -> eb.send("aaa", eventMessage, h));

            //Message<EventMessage> reply1 = awaitResult(h -> eb.send("aaa", eventMessage, h));
            response.end(reply.body().getMessage());
        }catch (Exception e){
            response.end(e.getMessage());
        }*/
    EventBus eb = vertx.eventBus();
    EventMessage eventMessage = EventMessage.message(null);
    eventMessage.setKey("68257");
// Message<EventMessage> reply = awaitResult(h -> eb.send("aaa", eventMessage, h));
// Message<EventMessage> reply1 = awaitResult(h -> eb.send("aaa", eventMessage, h));
// response.end(reply.body().getMessage());
}
Also used : EventMessage(ren.yale.java.event.EventMessage) EventBus(io.vertx.core.eventbus.EventBus) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 22 with EventBus

use of io.vertx.core.eventbus.EventBus in project hono by eclipse.

the class FileBasedCredentialsServiceTest method setUp.

/**
 * Sets up fixture.
 */
@Before
public void setUp() {
    fileSystem = mock(FileSystem.class);
    Context ctx = mock(Context.class);
    eventBus = mock(EventBus.class);
    vertx = mock(Vertx.class);
    when(vertx.eventBus()).thenReturn(eventBus);
    when(vertx.fileSystem()).thenReturn(fileSystem);
    props = new FileBasedCredentialsConfigProperties();
    svc = new FileBasedCredentialsService();
    svc.setConfig(props);
    svc.init(vertx, ctx);
}
Also used : TestContext(io.vertx.ext.unit.TestContext) Context(io.vertx.core.Context) FileSystem(io.vertx.core.file.FileSystem) EventBus(io.vertx.core.eventbus.EventBus) Vertx(io.vertx.core.Vertx) Before(org.junit.Before)

Example 23 with EventBus

use of io.vertx.core.eventbus.EventBus in project hono by eclipse.

the class FileBasedRegistrationServiceTest method setUp.

/**
 * Sets up the fixture.
 */
@Before
public void setUp() {
    fileSystem = mock(FileSystem.class);
    Context ctx = mock(Context.class);
    eventBus = mock(EventBus.class);
    vertx = mock(Vertx.class);
    when(vertx.eventBus()).thenReturn(eventBus);
    when(vertx.fileSystem()).thenReturn(fileSystem);
    props = new FileBasedRegistrationConfigProperties();
    props.setFilename(FILE_NAME);
    registrationService = new FileBasedRegistrationService();
    registrationService.setConfig(props);
    registrationService.init(vertx, ctx);
}
Also used : TestContext(io.vertx.ext.unit.TestContext) Context(io.vertx.core.Context) FileSystem(io.vertx.core.file.FileSystem) EventBus(io.vertx.core.eventbus.EventBus) Vertx(io.vertx.core.Vertx) Before(org.junit.Before)

Example 24 with EventBus

use of io.vertx.core.eventbus.EventBus in project hono by eclipse.

the class FileBasedTenantServiceTest method setUp.

/**
 * Sets up fixture.
 */
@Before
public void setUp() {
    fileSystem = mock(FileSystem.class);
    Context ctx = mock(Context.class);
    eventBus = mock(EventBus.class);
    vertx = mock(Vertx.class);
    when(vertx.eventBus()).thenReturn(eventBus);
    when(vertx.fileSystem()).thenReturn(fileSystem);
    props = new FileBasedTenantsConfigProperties();
    svc = new FileBasedTenantService();
    svc.setConfig(props);
    svc.init(vertx, ctx);
}
Also used : TestContext(io.vertx.ext.unit.TestContext) Context(io.vertx.core.Context) FileSystem(io.vertx.core.file.FileSystem) EventBus(io.vertx.core.eventbus.EventBus) Vertx(io.vertx.core.Vertx) Before(org.junit.Before)

Aggregations

EventBus (io.vertx.core.eventbus.EventBus)24 Test (org.junit.Test)11 CountDownLatch (java.util.concurrent.CountDownLatch)10 Context (io.vertx.core.Context)8 Vertx (io.vertx.core.Vertx)8 Buffer (io.vertx.core.buffer.Buffer)8 DeliveryOptions (io.vertx.core.eventbus.DeliveryOptions)8 MessageConsumer (io.vertx.core.eventbus.MessageConsumer)7 JsonObject (io.vertx.core.json.JsonObject)7 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)7 DeploymentOptions (io.vertx.core.DeploymentOptions)5 Future (io.vertx.core.Future)5 Verticle (io.vertx.core.Verticle)5 ReplyFailure (io.vertx.core.eventbus.ReplyFailure)5 FileSystem (io.vertx.core.file.FileSystem)5 Consumer (java.util.function.Consumer)5 CharsetUtil (io.netty.util.CharsetUtil)4 VertxOptions (io.vertx.core.VertxOptions)4 DatagramSocket (io.vertx.core.datagram.DatagramSocket)4 io.vertx.core (io.vertx.core)3