Skip to content

Instantly share code, notes, and snippets.

@simodima
Created August 18, 2018 14:14
Show Gist options
  • Save simodima/6e516fd81814de870ae5fee29f9bc804 to your computer and use it in GitHub Desktop.
Save simodima/6e516fd81814de870ae5fee29f9bc804 to your computer and use it in GitHub Desktop.
<?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