/** * {@inheritdoc} */ public function process(CommandMessage $message, callable $next) { $name = $message->payloadType()->toString(); $this->logger->info(sprintf('Command received {%s}', $name), ['message' => $message->toString()]); $next($message); $this->logger->info(sprintf('Command handled {%s}', $name), ['message' => $message->toString()]); }
/** * {@inheritdoc} */ public function process(CommandMessage $message, callable $next) { $command = ClassName::short($message->payloadType()->toString()); try { $this->logger->debug(sprintf('Command (%s) received: %s', $command, date(DATE_ATOM)), ['message' => $message->toString()]); $next($message); $this->logger->debug(sprintf('Command (%s) handled: %s', $command, date(DATE_ATOM)), ['message' => $message->toString()]); } catch (Exception $exception) { $this->logger->error(sprintf('Command (%s) failed: %s', $command, date(DATE_ATOM)), ['message' => $message->toString(), 'exception' => $exception]); throw $exception; } }
public function test_that_payload_type_returns_expected_instance() { $expected = 'Novuso.Test.Common.Resources.Domain.Messaging.Command.RegisterUserCommand'; $this->assertSame($expected, (string) $this->message->payloadType()); }