Duplicated SUBSCRIPTION_CREATION event

88 views
Skip to first unread message

lucas...@iquall.net

unread,
Mar 16, 2017, 5:17:08 PM3/16/17
to Kill Bill users mailing-list
Hi!

I wrote a small server to watch kill bill notifications, and i'm getting duplicated "SUBSCRIPTION_CREATION" events. Is this normal or am i missing something?

Example output:

2017-03-16T20:54:00.389Z - debug: Event received: eventType=SUBSCRIPTION_CREATION, accountId=204b5282-6929-462f-955f-39fef4a2304b, objectType=SUBSCRIPTION, objectId=311f4c14-7a0c-418c-a902-2b3d7935cd11
2017-03-16T20:54:00.390Z - info: ::ffff:192.168.127.156 - - [16/Mar/2017:20:54:00 +0000] "POST / HTTP/1.1" 500 - "-" "AHC/1.0"

2017-03-16T20:54:00.401Z - debug: Event received: eventType=ENTITLEMENT_CREATION, accountId=204b5282-6929-462f-955f-39fef4a2304b, objectType=SUBSCRIPTION, objectId=311f4c14-7a0c-418c-a902-2b3d7935cd11
2017-03-16T20:54:00.401Z - info: ::ffff:192.168.127.156 - - [16/Mar/2017:20:54:00 +0000] "POST / HTTP/1.1" 500 - "-" "AHC/1.0"

2017-03-16T20:54:00.406Z - debug: Event received: eventType=SUBSCRIPTION_CREATION, accountId=204b5282-6929-462f-955f-39fef4a2304b, objectType=SUBSCRIPTION, objectId=311f4c14-7a0c-418c-a902-2b3d7935cd11
2017-03-16T20:54:00.407Z - info: ::ffff:192.168.127.156 - - [16/Mar/2017:20:54:00 +0000] "POST / HTTP/1.1" 500 - "-" "AHC/1.0"

Pierre-Alexandre Meyer

unread,
Mar 17, 2017, 3:53:05 AM3/17/17
to lucas...@iquall.net, Kill Bill users mailing-list
Hi Lucas,

Make sure to return a 2xx HTTP status code from your server: if anything else is returned (e.g. 500) or if your app is down, Kill Bill will retry sending these events. The retry policy can be configured via the per-tenant property org.killbill.billing.server.notifications.retries (15m,30m,2h,12h,1d by default).

Hope that helps,


--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-users+unsubscribe@googlegroups.com.
To post to this group, send email to killbilling-users@googlegroups.com.
Visit this group at https://groups.google.com/group/killbilling-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/27575e94-3e41-49f6-a3c6-33464dd5df3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Pierre
Message has been deleted

lucas...@iquall.net

unread,
Mar 17, 2017, 9:48:58 AM3/17/17
to Kill Bill users mailing-list, lucas...@iquall.net
Hi Pierre,

I'm returning 200. I checked the "queue" tab and its empty.

I tried hardcoding 500 as the status code, and i see 3 (SUBSCRIPTION, ENTITLEMENT, SUBSCRIPTION2) events in the "queue" tab.

Any other idea?

Thanks for your help!

Pierre-Alexandre Meyer

unread,
Mar 17, 2017, 10:52:00 AM3/17/17
to Lucas Hamie, Kill Bill users mailing-list
Hi Lucas,

Another thought: when a subscription is created, cancelled, etc. two events are sent, one when the change is requested and one when the change is effective. Could you check the metadata field you are receiving on the events? It should specify an actionType.

If the action is immediate, you would indeed receive two SUBSCRIPTION_CREATION events (with two different metadata fields though).

Additionally, when the subscription is created, an additional event ENTITLEMENT_CREATION is also sent for the entitlement (see http://killbill.io/blog/blockingstate-abstractions).

Hope that clarifies things.





    Lucas G. Hamie
    Av. Honorio Pueyrredón 1475
    C.A.B.A. República Argentina
    TEL+54.11.4855.6041 (Ext. 526)
    lucas...@iquall.net
    www.iquall.net



--
Pierre

Lucas Hamie

unread,
Mar 17, 2017, 11:00:58 AM3/17/17
to Pierre-Alexandre Meyer, Kill Bill users mailing-list

​I think that's it, the two events with different metadata fields.

Thanks!​

Lucas Hamie

unread,
Mar 23, 2017, 5:46:44 PM3/23/17
to Pierre-Alexandre Meyer, Kill Bill users mailing-list
Hi Pierre, sorry to bother you again.

Where is the "metadata" field? I captured the packet with Wireshark and couldn't find the field. This is what the POST looks like. 

POST / HTTP/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 166
Connection: keep-alive
Accept: */*
User-Agent: AHC/1.0

{"eventType":"SUBSCRIPTION_CREATION","accountId":"0c7a39dc-81c2-436c-8b70-1986097148f2","objectType":"SUBSCRIPTION","objectId":"a83750d3-558d-4715-8fe6-ae3ff855ad8e""}

Pierre-Alexandre Meyer

unread,
Mar 24, 2017, 4:48:37 AM3/24/17
to Lucas Hamie, Kill Bill users mailing-list
Hi Lucas,

Which version of Kill Bill are you running? This field is only available starting with 0.18.0.
--
Pierre

Lucas Hamie

unread,
Mar 27, 2017, 12:21:56 PM3/27/17
to Pierre-Alexandre Meyer, Kill Bill users mailing-list
I'm running 0.18.3 . I though I would find those fields in an HTTP header, but they don't seem to be there.

Pierre-Alexandre Meyer

unread,
Mar 27, 2017, 12:59:44 PM3/27/17
to Lucas Hamie, Kill Bill users mailing-list
Hi Lucas,

No, they should all be part of the json payload.

On Mon, Mar 27, 2017 at 9:21 AM, Lucas Hamie <lucas...@iquall.net> wrote:
I'm running 0.18.3 . I though I would find those fields in an HTTP header, but they don't seem to be there.



--
Pierre

Lucas Hamie

unread,
Mar 27, 2017, 3:30:04 PM3/27/17
to Pierre-Alexandre Meyer, Kill Bill users mailing-list
Might this be a bug? Should I try updating to a newer version? Any configuration that might be missing or something that I should take on account?

Thanks for you help, Pierre.




    Lucas G. Hamie
    Av. Honorio Pueyrredón 1475
    C.A.B.A. República Argentina
    TEL+54.11.4855.6041 (Ext. 526)
    lucas...@iquall.net
    www.iquall.net

edd...@gmail.com

unread,
Mar 27, 2017, 9:04:57 PM3/27/17
to Kill Bill users mailing-list, pie...@kill-bill.org, lucas...@iquall.net
I'm experiencing the same issue. Running on 0.18.4, and all callback messages have only these 4 fields.
- eventType
- accountId
- objectType
- objectId

Thanks,

Ed

On Monday, March 27, 2017 at 12:30:04 PM UTC-7, Lucas Hamie wrote:
> Might this be a bug? Should I try updating to a newer version? Any configuration that might be missing or something that I should take on account?
>
>
> Thanks for you help, Pierre.
>
>
>
>
>
>
>
>
>
>
>
>

Pierre-Alexandre Meyer

unread,
Mar 28, 2017, 6:14:09 AM3/28/17
to edd...@gmail.com, Lucas Hamie, Kill Bill users mailing-list
Ed, Lucas,

I was indeed able to reproduce it :( It turns out the metadata field is available to plugins, but not yet to HTTP push notifications.

I've created https://github.com/killbill/killbill/issues/726 for tracking, but due to our API change policy, we might not be able to push a fix in 0.18.x. I suggest you subscribe to the issue in GitHub, we'll discuss it internally.

In the meantime, your application will have to deal with duplicated SUBSCRIPTION_ events (i.e. sent twice in a row if requested and effective dates are equal). Happy to go in more details or help with other workarounds if needed.

Thanks for the report!
--
Pierre

Lucas Hamie

unread,
Mar 28, 2017, 9:20:28 AM3/28/17
to Pierre-Alexandre Meyer, edd...@gmail.com, Kill Bill users mailing-list
Thanks for your work, Pierre :)
Reply all
Reply to author
Forward
0 new messages