MCPcopy Create free account
hub / github.com/StackStorm/st2 / process_task

Method process_task

st2common/st2common/services/triggerwatcher.py:91–125  ·  view source on GitHub ↗
(self, body, message)

Source from the content-addressed store, hash-verified

89 ]
90
91 def process_task(self, body, message):
92 LOG.debug("process_task")
93 LOG.debug(" body: %s", body)
94 LOG.debug(" message.properties: %s", message.properties)
95 LOG.debug(" message.delivery_info: %s", message.delivery_info)
96
97 routing_key = message.delivery_info.get("routing_key", "")
98 handler = self._handlers.get(routing_key, None)
99
100 try:
101 if not handler:
102 LOG.debug("Skipping message %s as no handler was found.", message)
103 return
104
105 trigger_type = getattr(body, "type", None)
106 if self._trigger_types and trigger_type not in self._trigger_types:
107 LOG.debug(
108 "Skipping message %s since trigger_type doesn't match (type=%s)",
109 message,
110 trigger_type,
111 )
112 return
113
114 try:
115 handler(body)
116 except Exception as e:
117 LOG.exception(
118 "Handling failed. Message body: %s. Exception: %s",
119 body,
120 six.text_type(e),
121 )
122 finally:
123 message.ack()
124
125 concurrency.sleep(self.sleep_interval)
126
127 def start(self):
128 try:

Callers

nothing calls this directly

Calls 2

ackMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected