public class SyncAsyncProcessor extends Object
| Modifier and Type | Method and Description |
|---|---|
static SyncAsyncProcessor |
getInstance(MessageProducer producer,
MessageConsumer messageConsumer) |
<R extends AbstractResponse,T extends AbstractResponse> |
sendAndReceive(R request,
long timeout)
takes in a request
creates an Observer to subscribe for a response
submits a task asynchronously to executorService for a response whenever it's available or timesout
Produces a message to a message bus for backend processing
|
public static SyncAsyncProcessor getInstance(MessageProducer producer, MessageConsumer messageConsumer)
public <R extends AbstractResponse,T extends AbstractResponse> T sendAndReceive(R request, long timeout) throws InterruptedException, ExecutionException, TimeoutException
R - extends AbstractResponseT - extends AbstractResponsetimeout - in Millisecondsrequest - for processingNullPointerException - null request or eventIdInterruptedException - interruption causedExecutionException - execution issueTimeoutException - took longer than the passed millisecondsResponseObservable.addObservers(ResponseObserver),
ExecutorService.submit(Callable),
MessageProducer.produceMessage(AbstractResponse)Copyright © 2016. All rights reserved.