Skip to content

Commit ca8d14d

Browse files
Add DEFAULT_CONTENT_TYPE constant to Producer (text/plain)
1 parent 4e4d3c4 commit ca8d14d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace OldSound\RabbitMqBundle\DependencyInjection;
44

5+
use OldSound\RabbitMqBundle\RabbitMq\Producer;
56
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
67
use Symfony\Component\Config\Definition\ConfigurationInterface;
78
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
@@ -125,7 +126,7 @@ protected function addProducers(ArrayNodeDefinition $node)
125126
->scalarNode('enable_logger')->defaultFalse()->end()
126127
->scalarNode('service_alias')->defaultValue(null)->end()
127128
->scalarNode('default_routing_key')->defaultValue('')->end()
128-
->scalarNode('default_content_type')->defaultValue('text/plain')->end()
129+
->scalarNode('default_content_type')->defaultValue(Producer::DEFAULT_CONTENT_TYPE)->end()
129130
->integerNode('default_delivery_mode')->min(1)->max(2)->defaultValue(2)->end()
130131
->end()
131132
->end()

RabbitMq/Producer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
*/
1111
class Producer extends BaseAmqp implements ProducerInterface
1212
{
13-
protected $contentType = 'text/plain';
13+
const DEFAULT_CONTENT_TYPE = 'text/plain';
14+
protected $contentType = Producer::DEFAULT_CONTENT_TYPE;
1415
protected $deliveryMode = 2;
1516
protected $defaultRoutingKey = '';
1617

0 commit comments

Comments
 (0)