-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,11 +44,11 @@ php bin/console doctrine:schema:update --force | |
|
||
### 7. Access the app | ||
|
||
Your app is runnint locally under [https://127.0.0.1:8000](https://127.0.0.1:8000) | ||
Your app is running locally under [https://127.0.0.1:8000](https://127.0.0.1:8000) | ||
|
||
### 8. Access the RabbitMQ admin console | ||
|
||
Your app is runnint locally under [http://guest:[email protected]:15672](http://guest:[email protected]:15672) | ||
Your app is running locally under [http://guest:[email protected]:15672](http://guest:[email protected]:15672) | ||
|
||
# Learnings | ||
|
||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace App\MessageHandler; | ||
|
||
|
||
use App\Message\FileUploadMessage; | ||
use App\Repository\FileUploadRepository; | ||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface; | ||
|
||
class FileUploadMessageHandler implements MessageHandlerInterface | ||
{ | ||
/** | ||
* @var FileUploadRepository | ||
*/ | ||
private $repository; | ||
|
||
public function __construct(FileUploadRepository $repository) | ||
{ | ||
$this->repository = $repository; | ||
} | ||
|
||
public function __invoke(FileUploadMessage $message) | ||
{ | ||
echo 'File upload received: ' . $message->getId(); | ||
|
||
// Fake being busy. | ||
sleep(1); | ||
|
||
// fetch entity | ||
$entity = $this->repository->find($message->getId()); | ||
|
||
if ($entity) | ||
{ | ||
// update status | ||
$entity->setStatus("handled"); | ||
$this->repository->save($entity); | ||
} | ||
|
||
// TODO Handle errors which might occur during handling the message! | ||
} | ||
} |