我有这段代码:
require 'json'
class PaymentEvents < Workers
include Sneakers::Worker
from_queue "my-queue",
exchange: 'payment',
exchange_type: :topic,
exchange_options: { durable: true },
queue_options: { durable: true },
routing_key: 'event.payment.*',
timeout_job_after: 120
def internal_work(msg)
#do stuff here, according to the type of the event
ack!
end
因为我的routing_key是&#34; event.payment。*&#34;,有没有办法确切知道接收的是什么事件?
答案 0 :(得分:0)
我快速浏览了一下,看起来您可以实施work_with_params
而不是work
,并且您将传递其他参数。