mirror of https://github.com/deavmi/tasky.git
Engine
- If a `Request` is not expecting a response then do not call `dequeue()` on the `Queue` registered nor `process`byte[])` - Added a TODO comment
This commit is contained in:
parent
8387d0ee78
commit
a51df3b699
|
@ -14,6 +14,8 @@ public class Engine
|
||||||
|
|
||||||
// TODO: Continue working on this
|
// TODO: Continue working on this
|
||||||
|
|
||||||
|
// TODO: Allow registering ResponseAnonymous with handlers etc
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a request and sends it through to the endpoint
|
* Takes a request and sends it through to the endpoint
|
||||||
* afterwhich we block for a response and when we get one
|
* afterwhich we block for a response and when we get one
|
||||||
|
@ -35,11 +37,16 @@ public class Engine
|
||||||
/* Send the message */
|
/* Send the message */
|
||||||
tManager.sendMessage(tReq);
|
tManager.sendMessage(tReq);
|
||||||
|
|
||||||
/* Await for a response */
|
/* Does this Request expect a response? */
|
||||||
byte[] resp = newQueue.dequeue().getPayload();
|
// TODO: We need not register the queue even if this is the case
|
||||||
|
if(req.expectsResponse())
|
||||||
|
{
|
||||||
|
/* Await for a response */
|
||||||
|
byte[] resp = newQueue.dequeue().getPayload();
|
||||||
|
|
||||||
/* Run the response handler with the response */
|
/* Run the response handler with the response */
|
||||||
req.process(resp);
|
req.process(resp);
|
||||||
|
}
|
||||||
|
|
||||||
/* De-register the queue */
|
/* De-register the queue */
|
||||||
tManager.releaseQueue(newQueue);
|
tManager.releaseQueue(newQueue);
|
||||||
|
|
Loading…
Reference in New Issue