You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't have any other children of "process" node in Consul. I just have json data for that node and that's all.
Now I keep a watch on that same node from below code. My idea is to keep a watch on the same node and get the value of "process" key in the code and whenever it is updated again from outside I want my watch to be triggered as well and then get the value of "process" key again on every reload whenever there is a change.
With the above code when I run it, I get an exception as below:
'The key must not be null or empty. Ensure that there is at least one key under the root of the process or that the data there contains more than just a single value.'
But if I just keep a watch on "data/stage" node then it works fine without any error and I can get the value of "process" key in the code so my question is - can I not just keep a watch on the same node for which I want to get the value also?
The text was updated successfully, but these errors were encountered:
From a quick glance at your code it looks like you've made a mistake with the Parser option you've chosen when calling AddConsul.
You've set the parser as a SimpleConfigurationParser when actually you're trying to parse a JSON node. If you remove this option it will default to JsonConfigurationParser and it should work fine.
Thanks for your quick response. I removed that parser line and after that I don't see any error but when I try to get the value of "process" key I don't get any data now. This is the way I am getting value -
string val = configuration["process"]
// and then parse this json "val" to get data I need
But if I keep a watch on this node "data/stage" and then get value of "process" node using above code with SimpleConfigurationParser then it worked fine but if I remove SimpleConfigurationParser then it doesn't work as well.
Below is what I have noticed -
With node data/stage/process and removing parser line I don't see any value of "process" key being printed out.
With node data/stage/ and removing parser line I don't see any value of "process" key being printed out again.
But with node data/stage/ and keeping SimpleConfigurationParser parser line I see the value being printed out.
And I want to keep a watch on this node directly data/stage/process and then get the value of process key internally in the code.
I have a node (with data) in Consul like below:
I don't have any other children of "process" node in Consul. I just have json data for that node and that's all.
Now I keep a watch on that same node from below code. My idea is to keep a watch on the same node and get the value of "process" key in the code and whenever it is updated again from outside I want my watch to be triggered as well and then get the value of "process" key again on every reload whenever there is a change.
With the above code when I run it, I get an exception as below:
'The key must not be null or empty. Ensure that there is at least one key under the root of the process or that the data there contains more than just a single value.'
But if I just keep a watch on "data/stage" node then it works fine without any error and I can get the value of "process" key in the code so my question is - can I not just keep a watch on the same node for which I want to get the value also?
The text was updated successfully, but these errors were encountered: