/**
  * Publish the given Message by serializing it and handing it over to a RabbitMQ producer
  *
  * @{inheritdoc}
  */
 public function publish($message)
 {
     $serializedMessage = $this->serializer->wrapAndSerialize($message);
     $routingKey = $this->routingKeyResolver->resolveRoutingKeyFor($message);
     $additionalProperties = $this->additionalPropertiesResolver->resolveAdditionalPropertiesFor($message);
     $this->producer->publish($serializedMessage, $routingKey, $additionalProperties);
 }
 /**
  * @param string $serializedEnvelope
  */
 public function consume($serializedEnvelope)
 {
     // Unserialize
     $envelope = $this->messageInEnvelopeSerializer->unwrapAndDeserialize($serializedEnvelope);
     // Tell the world
     $this->dispathcer->dispatch(PreHandleMessage::NAME, new PreHandleMessage($envelope));
     // Handle the message
     $this->messageBus->handle($envelope->message());
 }
 public function consume($serializedEnvelope)
 {
     $envelope = $this->messageInEnvelopeSerializer->unwrapAndDeserialize($serializedEnvelope);
     $this->messageBus->handle($envelope->message());
 }
 /**
  * Deserialize a Message that was wrapped in an Envelope.
  *
  * {@inheritdoc}
  */
 public function unwrapAndDeserialize($serializedEnvelope)
 {
     return $this->serializer->unwrapAndDeserialize($serializedEnvelope);
 }