Skip to content

Commit 7e6f4d6

Browse files
committed
Allow to enable SSL, depend the uri scheme on that. Backwards compatible.
1 parent fc44a92 commit 7e6f4d6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/bundle/config_reference.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ enqueue:
2121
connection_timeout: 1
2222
buffer_size: 1000
2323
lazy: true
24+
25+
# Should be true if you want to use secure connections. False by default
26+
ssl_on: false
2427
rabbitmq_stomp:
2528
host: localhost
2629
port: 61613

pkg/stomp/StompConnectionFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class StompConnectionFactory implements PsrConnectionFactory
2828
* 'connection_timeout' => 1,
2929
* 'sync' => false,
3030
* 'lazy' => true,
31+
* 'ssl_on' => false,
3132
* ].
3233
*
3334
* or
@@ -75,7 +76,8 @@ private function establishConnection()
7576
if (false == $this->stomp) {
7677
$config = $this->config;
7778

78-
$uri = 'tcp://'.$config['host'].':'.$config['port'];
79+
$scheme = ($config['ssl_on'] === true) ? 'ssl' : 'tcp';
80+
$uri = $scheme . '://' . $config['host'] . ':' . $config['port'];
7981
$connection = new Connection($uri, $config['connection_timeout']);
8082

8183
$this->stomp = new BufferedStompClient($connection, $config['buffer_size']);
@@ -134,6 +136,7 @@ private function defaultConfig()
134136
'connection_timeout' => 1,
135137
'sync' => false,
136138
'lazy' => true,
139+
'ssl_on' => false,
137140
];
138141
}
139142
}

0 commit comments

Comments
 (0)