added rabbitmq helpers and setup command
This commit is contained in:
@@ -5,6 +5,8 @@ from flask import current_app
|
||||
from flask.cli import with_appcontext
|
||||
from werkzeug.exceptions import MethodNotAllowed, NotFound
|
||||
|
||||
import rmq_helper
|
||||
from .target.models import Target
|
||||
from .target_exchange.models import TargetExchange
|
||||
|
||||
|
||||
@@ -91,3 +93,16 @@ def seed():
|
||||
|
||||
TargetExchange.ensure_created("")
|
||||
TargetExchange.ensure_created("webhooks")
|
||||
|
||||
|
||||
@click.command()
|
||||
@with_appcontext
|
||||
def setup_rabmq():
|
||||
"""Set up rabbitMQ"""
|
||||
for exchange in TargetExchange.query.filter(TargetExchange.name != "").all():
|
||||
rmq_helper.ensure_exchange_exists(exchange.name)
|
||||
|
||||
for target in Target.query.join(Target.exchange).filter(TargetExchange.name == "").all():
|
||||
rmq_helper.ensure_queue_exists(target.routing_key)
|
||||
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user