vertx / io.vertx.ext.sync / Sync / awaitEvent

# awaitEvent

`@Suspendable open static fun <T : Any> awaitEvent(consumer: Consumer<Handler<T>>): T`

Receive a single event from a handler synchronously. The fiber will be blocked until the event occurs. No kernel thread is blocked.

### Parameters

`consumer` - this should encapsulate the setting of the handler to receive the event. The handler is passed to it.

`` - the type of the event

Return
the event

`@Suspendable open static fun <T : Any> awaitEvent(consumer: Consumer<Handler<T>>, timeout: Long): T`

Receive a single event from a handler synchronously. The fiber will be blocked until the event occurs. No kernel thread is blocked.

### Parameters

`consumer` - this should encapsulate the setting of the handler to receive the event. The handler is passed to it.

`timeout` - In milliseconds when to cancel the awaited event

`` - the type of the event

Return
the event