Created
August 18, 2018 14:14
-
-
Save simodima/6e516fd81814de870ae5fee29f9bc804 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* We're using a message bus, this is | |
* the fetch-car message handler. | |
*/ | |
class FetchCarMessageHandler | |
{ | |
public function handle(Message $msg) | |
{ | |
while (true) { | |
try { | |
$id = (int)$msg->getContent(); | |
$car = $client->get('/car/'.$id); | |
return Result::success($car); | |
} catch (TimeoutException $e) { | |
// Nothing to do, just retry the api call | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment