2016-04-19 22 views
1

我試圖防止反覆Webhooks被執行多次,如果他們不正確地重試(即:建立時出現和服務器偶爾超時)。我在儀表板中看到webhooks具有唯一的ID,但這些似乎無法在消息散列中訪問,我錯過了什麼?我使用的是Rails的價值。反覆Webhook ID

<?xml version="1.0" encoding="UTF-8"?> 
<updated_subscription_notification> 
    <account> 
    <account_code>1</account_code> 
    <username nil="true"></username> 
    <email>[email protected]</email> 
    <first_name>Verena</first_name> 
    <last_name>Example</last_name> 
    <company_name nil="true"></company_name> 
    </account> 
    <subscription> 
    <plan> 
     <plan_code>1dpt</plan_code> 
     <name>Subscription One</name> 
    </plan> 
    <uuid>292332928954ca62fa48048be5ac98ec</uuid> 
    <state>active</state> 
    <quantity type="integer">1</quantity> 
    <total_amount_in_cents type="integer">200</total_amount_in_cents> 
    <activated_at type="datetime">2010-09-23T22:12:39Z</activated_at> 
    <canceled_at nil="true" type="datetime"></canceled_at> 
    <expires_at nil="true" type="datetime"></expires_at> 
    <current_period_started_at type="datetime">2010-09-23T22:03:30Z</current_period_started_at> 
    <current_period_ends_at type="datetime">2010-09-24T22:03:30Z</current_period_ends_at> 
    <trial_started_at nil="true" type="datetime"> 
    </trial_started_at> 
    <trial_ends_at nil="true" type="datetime"> 
    </trial_ends_at> 
    <collection_method>automatic</collection_method> 
    </subscription> 
</updated_subscription_notification> 

回答

1

一個網絡掛接,可以退休了幾次,但一次成功的狀態碼是由您的服務器接收,Recurly將停止嘗試重新發送該通知。因此,每個活動只會提供一個webhook。此外,webhook ID不包含在消息哈希中,它們只能在UI中找到。

1

不幸的是,從重新發送停止網絡掛接的唯一方法是用5秒200個狀態碼回覆。(https://docs.recurly.com/docs/webhooks

它爲30秒但得到了改變2015年11月,我認爲。

無論如何,我通過將消息拋出隊列並立即響應200響應來解決它。