2
votes

I've one instance of the Orion context broker running and several other services receiving notifications from it through "ONCHANGE" subscriptions.

I also have a simple script that checks the existing subscriptions through GET /v2/subscriptions and then renews them as needed. However this end point does not return the format (XML/JSON) that the data is sent for each subscriber.

The problem is that different services require different formats and without knowing the initial Accept header is not possible to renew the subscription correctly, since the format is also updated when a call to any of the update methods is made (POST /v1/updateContextSubscription or PUT /v1/contextSubscriptions/{subscriptionID}), defaulting to XML

Is there a way I can know the format of a subscription without accessing directly to the Mongo database? or any update method that does not change the format of the messages set up initially?

1
What do you mean by "the format of a subscription"? Maybe the format of the notifications sent due to the subscription? Just to confirm in order to answer properly... Thanks! - fgalan
@fgalan yes, I meant the format of the notifications, the one that you specify in the Accept header when you create a subscription. - dethos

1 Answers

0
votes

XML is deprecated since Orion 0.23.0 (more info here). Thus, I recommend you to adapt all the notification receptors to process only JSON and update subscription using always JSON.

Otherwise, your update subscription program needs to to keep track of which format is being used by each receptor (in a URL->format table) in order to choose the right one in each case.