Webhooks Bug??  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Webhooks Bug??

Postby SBarnes » Mon May 17, 2021 11:31 am

The below code inserts into SY_WebhookMessage when an attempted post doesn't work, however it is not taking into account whether or not the subscriber itself is enabled.

Code: Select all
string sql = @"INSERT INTO SY_WebhookMessage(RecID, SY_WebhookSubscription_RecID, Body, ItemNo, Status, LastSavedDateTime, AddedDateTime, Retries)
                  SELECT NewID(), SY_WebhookSubscription.RecID, @Body,
                  COALESCE(QueueTable.MaximumItemNo, 0) + ROW_NUMBER() OVER (ORDER BY (SELECT NULL)),
                  0, SYSUTCDATETIME(), SYSUTCDATETIME(), 0
                  FROM SY_WebhookSubscription
                  CROSS JOIN (SELECT MAX(ItemNo) AS MaximumItemNo FROM SY_WebhookMessage) QueueTable
                  WHERE EventName = @EventName
                  ORDER BY SY_WebhookSubscription.ItemNo";
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Webhooks Bug??  Topic is solved

Postby Scott.Pearce » Mon May 17, 2021 11:34 am

Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Webhooks Bug??

Postby SBarnes » Mon May 17, 2021 12:23 pm

Thanks Scott,

It can be an even bigger issue because if you then re-enable the subscriber the api can run out of memory when there are too many items in SY_WebhookMessage that haven't be closed off with a response and the api loads them for processing, Mike is aware of this.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to REST API

Who is online

Users browsing this forum: No registered users and 3 guests