Open APIs

 View Only
  • 1.  How can listener get TMF API name from incoming event

    TM Forum Member
    Posted Dec 28, 2019 21:30

    Hi,

    This is a question regarding the event processed by a listener.

    Background for the question …

    We have a bit unconventional requirement for listening to TMF events - as described below.

    a) Various clients register with a central service for TMF events they are interested in (by providing the name of the TMF API - such as 'troubleTicketManagement' among other things)
    b) The central service itself listens to all the above registered events
    c) The central service then forwards the received events to the various clients in a) as per registration.

    The reason for the above logic is that the client applications in a) are not aware of each other, thus needing the central service.

    Now for the actual question …

    Our requirement is to find the TMF API name from the incoming event.

    Taking the example of a received 'troubleTicket' event in 'REST API Design Guidelines Part 1', one can check the field eventType at the top level (in this case 'TroubleTicketStateChangeNotification') and then look up a table that maps each event type to the TMF API (in this case 'troubleTicketManagement'). Of course, this means creating/maintaining a large map of such entries.

    I am wondering if the alternative could be as follows.

    • Get the element 'event' from the json document
    • Get the only(?) key under this (a variable key, but 'troubleTicket' in this example)
    • Get corresponding value structure
    • Parse this sub-json document to get 'href' value (in this example "https:server:port/troubleTicketManagement/troubleTicket/43")
    • Extract second token with delimiter being '/' (the API name 'troubleTicketManagement' in this example)

    Will the above work in all cases or is there a flaw? The goal is to avoid creating/maintaining the static map mentioned above, rather extract the API name from the event.

    Thanks.



    ------------------------------
    Madhu Narasimhan
    Oracle Corporation
    ------------------------------


  • 2.  RE: How can listener get TMF API name from incoming event

    TM Forum Member
    Posted Dec 29, 2019 08:46
    Hi Madhu

    Perhaps I missed something in your description above, but it is not clear to me why you need the API name. In an event-driven flow, the subscribers to an event presumably need to know that an entity (e.g. a Trouble Ticket) was created or changed, but why would they care which API caused that change. And indeed it is possible that entity events can be raised due to internal processing, without an API having been invoked.

    Adding @Pierre Gauthier and @Thomas Braun, who are working on event-based API.

    Hope it helps​​

    ------------------------------
    Jonathan Goldberg
    Amdocs Management Limited
    Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
    ------------------------------



  • 3.  RE: How can listener get TMF API name from incoming event

    TM Forum Member
    Posted Jan 01, 2020 23:52
    Hi Jonathan,

    Sorry if it was not clear. The notifications come to a central application that simply forwards them to subscribing clients based on the API triggering the event (example 'accountManagement'). I won't try to explain further because I have found a solution already.

    By TMF convention, the callback URL already has the API name ('accountManagement' in the example callback URL serverRoot/tmf-api/accountManagement/v4/listener/partyAccountAttributeValueChangeEvent). That should suffice for us.

    On a side note, you mentioned "And indeed it is possible that entity events can be raised due to internal processing, without an API having been invoked". I agree with that. I was simply referring to the API name that is part of the resource reference as in the example "https:server:port/troubleTicketManagement/troubleTicket/43".

    Thanks anyway for the quick response. I am good for now.

    ------------------------------
    Madhu Narasimhan
    Oracle Corporation
    ------------------------------



  • 4.  RE: How can listener get TMF API name from incoming event

    TM Forum Member
    Posted Dec 14, 2021 19:49
    Edited by Dimitrios Lagkouvardos Dec 14, 2021 19:53