Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow CloudConfigurationHandler to return RESPONSE_CODE_OK *after* the configuration has been effectively applied #5589

Open
reda-alaoui opened this issue Nov 26, 2024 · 3 comments

Comments

@reda-alaoui
Copy link

reda-alaoui commented Nov 26, 2024

Is your feature request related to a problem? Please describe.

Using Kapua Rest API, I am updating Kura component configurations. Kapua returns an HTTP success response before the configuration is effectivly applied in Kura. This is problematic when your configuration change must be effective before a dependent subsequent action.

I think it is caused by Kura CloudConfigurationHandler behaviour:

this.executor.schedule(new UpdateConfigurationsCallable(pid, xmlConfigs, this.configurationService), 1000,
TimeUnit.MILLISECONDS);
return new KuraResponsePayload(KuraResponsePayload.RESPONSE_CODE_OK);

The configuration update is asynchronously applied. The success response is probably sent before the configuration update process ends.

Describe the solution you'd like

I want Kura to send RESPONSE_CODE_OK after the configuration has really been applied.

Describe alternatives you've considered

My current workaround is to poll the configuration via Kapua REST API until I see my change.

@reda-alaoui reda-alaoui changed the title Allow CloudConfigurationHandler to return RESPONSE_CODE_OK after the configuration has been effectively applied Allow CloudConfigurationHandler to return RESPONSE_CODE_OK *after* the configuration has been effectively applied Nov 26, 2024
@mattdibi
Copy link
Contributor

Hi there @reda-alaoui,

thanks for reaching out!

Unfortunately your request is not feasible currently.

Our Rest APIs interact with what we call the ConfigurationService which is responsible for notifying each and every underlying component of the configuration change e providing the configuration. All of this is asynchronous in nature and quite hard (or downright impossible) to know when each subsystem completed the update.

We are aware of the current limitation (which also reflects on error reporting) and plan to work on it in the near future.

May I ask you what's your use case? Why do you need to know when the configuration was applied? Knowing that we might be able to propose other workarounds.

@reda-alaoui
Copy link
Author

Hi @mattdibi ,

My use case is some automaton that performs kura configuration changes expected to lead to the activation of a RequestHandler down the road. The automaton tries to send requests to the new handler just after the configuration change.

@mattdibi
Copy link
Contributor

mattdibi commented Dec 4, 2024

Hi @mattdibi ,

My use case is some automaton that performs kura configuration changes expected to lead to the activation of a RequestHandler down the road. The automaton tries to send requests to the new handler just after the configuration change.

I don't have the complete picture therefore take my suggestion with a grain of salt...

The fact that the RequestHandler starts responding should be the condition for which you know the configuration has taken effect, shouldn't it? I would probably poll that handler instead of the configuration via Kapua REST API. But, again, I don't have a complete picture.

If the above is not possible I would say that your solution is the best we can achieve at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants