Java Code Examples for io.vertx.core.eventbus.EventBus#request()
The following examples show how to use
io.vertx.core.eventbus.EventBus#request() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageConsumerMethodTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testSend() throws InterruptedException { EventBus eventBus = Arc.container().instance(EventBus.class).get(); BlockingQueue<Object> synchronizer = new LinkedBlockingQueue<>(); eventBus.request("foo", "hello", ar -> { if (ar.succeeded()) { try { synchronizer.put(ar.result().body()); } catch (InterruptedException e) { fail(e); } } else { fail(ar.cause()); } }); assertEquals("HELLO", synchronizer.poll(2, TimeUnit.SECONDS)); }
Example 2
Source File: MessageConsumerMethodTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testSendAsync() throws InterruptedException { EventBus eventBus = Arc.container().instance(EventBus.class).get(); BlockingQueue<Object> synchronizer = new LinkedBlockingQueue<>(); eventBus.request("foo-async", "hello", ar -> { if (ar.succeeded()) { try { synchronizer.put(ar.result().body()); } catch (InterruptedException e) { fail(e); } } else { fail(ar.cause()); } }); assertEquals("olleh", synchronizer.poll(2, TimeUnit.SECONDS)); }
Example 3
Source File: MessageConsumerMethodTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testSendAsyncUni() throws InterruptedException { EventBus eventBus = Arc.container().instance(EventBus.class).get(); BlockingQueue<Object> synchronizer = new LinkedBlockingQueue<>(); eventBus.request("foo-async-uni", "hello-uni", ar -> { if (ar.succeeded()) { try { synchronizer.put(ar.result().body()); } catch (InterruptedException e) { fail(e); } } else { fail(ar.cause()); } }); assertEquals("inu-olleh", synchronizer.poll(2, TimeUnit.SECONDS)); }
Example 4
Source File: MessageConsumerMethodTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testSendDefaultAddress() throws InterruptedException { EventBus eventBus = Arc.container().instance(EventBus.class).get(); BlockingQueue<Object> synchronizer = new LinkedBlockingQueue<>(); eventBus.request("io.quarkus.vertx.deployment.MessageConsumerMethodTest$SimpleBean", "Hello", ar -> { if (ar.succeeded()) { try { synchronizer.put(ar.result().body()); } catch (InterruptedException e) { fail(e); } } else { fail(ar.cause()); } }); assertEquals("hello", synchronizer.poll(2, TimeUnit.SECONDS)); }
Example 5
Source File: MessageConsumerMethodTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testRequestContext() throws InterruptedException { EventBus eventBus = Arc.container().instance(EventBus.class).get(); BlockingQueue<Object> synchronizer = new LinkedBlockingQueue<>(); eventBus.request("request", "Martin", ar -> { if (ar.succeeded()) { try { synchronizer.put(ar.result().body()); } catch (InterruptedException e) { fail(e); } } else { fail(ar.cause()); } }); assertEquals("MArtin", synchronizer.poll(2, TimeUnit.SECONDS)); }