Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

# 1.1.2
- Added virtual_host connection parameter to `queues_sensor`

# 1.1.1
- Updated pip dependency to pika `1.3.x` to support python >= 3.7

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and edit as required.
* ``host`` - RabbitMQ host to connect to.
* ``username`` - Username to connect to RabbitMQ (optional).
* ``password`` - Password to connect to RabbitMQ (optional).
* ``virtual_host`` - RabbitMQ virtual host to use.
* ``queues`` - List of queues to check for messages. See an example below.
* ``quorum_queues`` - List of queues defined in `queues` that should be handled as `type: quorum`
* ``deserialization_method`` - Which method to use to de-serialize the
Expand Down
5 changes: 5 additions & 0 deletions config.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ sensor_config:
description: "Optional password for RabbitMQ"
type: "string"
secret: true
virtual_host:
type: "string"
description: "RabbitMQ virtual host to use"
required: true
default: "/"
rabbitmq_queue_sensor:
description: "Queue settings"
type: "object"
Expand Down
2 changes: 1 addition & 1 deletion pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ keywords:
- aqmp
- stomp
- message broker
version: 1.1.1
version: 1.1.2
python_versions:
- "3"
author: StackStorm, Inc.
Expand Down
8 changes: 6 additions & 2 deletions sensors/queues_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(self, sensor_service, config=None):
self.host = self._config["sensor_config"]["host"]
self.username = self._config["sensor_config"]["username"]
self.password = self._config["sensor_config"]["password"]
self.virtual_host = self._config["sensor_config"]["virtual_host"]

queue_sensor_config = self._config["sensor_config"]["rabbitmq_queue_sensor"]
self.queues = queue_sensor_config["queues"]
Expand Down Expand Up @@ -73,10 +74,13 @@ def setup(self):
username=self.username, password=self.password
)
connection_params = pika.ConnectionParameters(
host=self.host, credentials=credentials
host=self.host, credentials=credentials, virtual_host=self.virtual_host
)
else:
connection_params = pika.ConnectionParameters(host=self.host)
connection_params = pika.ConnectionParameters(
host=self.host,
virtual_host=self.virtual_host
)

self.conn = pika.BlockingConnection(connection_params)
self.channel = self.conn.channel()
Expand Down