|
1
|
|
|
# Licensed to the StackStorm, Inc ('StackStorm') under one or more |
|
2
|
|
|
# contributor license agreements. See the NOTICE file distributed with |
|
3
|
|
|
# this work for additional information regarding copyright ownership. |
|
4
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0 |
|
5
|
|
|
# (the "License"); you may not use this file except in compliance with |
|
6
|
|
|
# the License. You may obtain a copy of the License at |
|
7
|
|
|
# |
|
8
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
|
9
|
|
|
# |
|
10
|
|
|
# Unless required by applicable law or agreed to in writing, software |
|
11
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
|
12
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13
|
|
|
# See the License for the specific language governing permissions and |
|
14
|
|
|
# limitations under the License. |
|
15
|
|
|
|
|
16
|
|
|
# All Exchanges and Queues related to liveaction. |
|
17
|
|
|
|
|
18
|
|
|
from kombu import Exchange, Queue |
|
19
|
|
|
from st2common.transport import publishers |
|
20
|
|
|
|
|
21
|
|
|
__all__ = [ |
|
22
|
|
|
'ActionExecutionPublisher', |
|
23
|
|
|
'ActionExecutionOutputPublisher', |
|
24
|
|
|
|
|
25
|
|
|
'get_queue', |
|
26
|
|
|
'get_output_queue' |
|
27
|
|
|
] |
|
28
|
|
|
|
|
29
|
|
|
EXECUTION_XCHG = Exchange('st2.execution', type='topic') |
|
30
|
|
|
EXECUTION_OUTPUT_XCHG = Exchange('st2.execution.output', type='topic') |
|
31
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
class ActionExecutionPublisher(publishers.CUDPublisher): |
|
34
|
|
|
def __init__(self, urls): |
|
35
|
|
|
super(ActionExecutionPublisher, self).__init__(urls, EXECUTION_XCHG) |
|
36
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
class ActionExecutionOutputPublisher(publishers.CUDPublisher): |
|
39
|
|
|
def __init__(self, urls): |
|
40
|
|
|
super(ActionExecutionOutputPublisher, self).__init__(urls, EXECUTION_OUTPUT_XCHG) |
|
41
|
|
|
|
|
42
|
|
|
|
|
43
|
|
|
def get_queue(name=None, routing_key=None, exclusive=False): |
|
44
|
|
|
return Queue(name, EXECUTION_XCHG, routing_key=routing_key, exclusive=exclusive) |
|
45
|
|
|
|
|
46
|
|
|
|
|
47
|
|
|
def get_output_queue(name=None, routing_key=None, exclusive=False): |
|
48
|
|
|
return Queue(name, EXECUTION_OUTPUT_XCHG, routing_key=routing_key, exclusive=exclusive) |
|
49
|
|
|
|