Skip to content

Commit

Permalink
Fixed issue with AMQPTable/array in headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasil coylOne Kulakov committed Aug 30, 2017
1 parent 8e93093 commit 2a38cf4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/EventBand/Transport/AmqpLib/AmqpMessageUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use EventBand\Transport\Amqp\Driver\CustomAmqpMessage;
use EventBand\Transport\Amqp\Driver\MessageDelivery;
use PhpAmqpLib\Message\AMQPMessage as AmqpLibMessage;
use PhpAmqpLib\Wire\AMQPTable;

/**
* Utils for AMQPMessage driver adoption
Expand Down Expand Up @@ -52,7 +53,12 @@ public static function createMessage(AmqpLibMessage $message)
}
}
if ($message->has('application_headers')) {
$properties['headers'] = $message->get('application_headers');
$headers = $message->get('application_headers');
if ($headers instanceof AMQPTable) {
$properties['headers'] = $headers->getNativeData();
} elseif (is_array($headers)) {
$properties['headers'] = $headers;
}
}

return CustomAmqpMessage::fromProperties($properties);
Expand Down

0 comments on commit 2a38cf4

Please sign in to comment.