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

Asynchronous Instance and binding create/delete operations #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danail-branekov
Copy link

@danail-branekov danail-branekov commented Jan 17, 2025

While implementing our OSBAPI client in Korifi, we needed to test our implementation against an async broker. We could not find one easily, therefore we changed the sample bookstore broker to create/delete instances and bindings asynchronously.

We thought that it might be useful to contribute that increment back to the upstream, so here is the PR.

There are few issues with the PR though (I am not a Java developer, so please tolerate me):

  • checkstyleMain complains that the imports order is incorrect. That order is produced by IDEA, I do not have the patience to fix them manually - any hints how to fix them automatically are welcome
  • there are a few failing tests complaining that mongo instance is not running. The broker works well in a docker image, maybe tests require mongo on my host but not sure how to configure one. There are no contribution guidelines here to point me to the correct setup

Before I carry on trying to iron those out, I would like to ask whether you are willing the merge such a PR at all. What do yuo think?

Create delete opertations submit tasks to the common fork-join pool to
implement asynchronous processing.

When creating:
* if the object being created already exists -> response with the object
  is returned
* otherwise,
  - a task is submitted to the common fork-join pool
  - the task is registered into a local synchronised map using the
    opearation name as key
  - async response is returned (resulting into `HTTP 202 Accepted`
    response)

When getting the last operation
* if a fork-join pool task with the operation name specified in the
  request does not exist, throw a
  `ServiceBrokerInvalidParametersException`
* Otherwise,
  - if the task has not completed, `in progress` response is returned
  - if the task has completed successfully, `succeess` is returned
  - if the task has failed, `failed` is returned
  - regardless is the task has succeeded or failed, it is deregistered
    from the `task` map

When deleting
* if the resource does not exist, throw `XXXDoesNotExistException`
  resulting into a `HTTP 410 Gone` response code
* otherwise
  - a task is submitted to the common fork-join pool
  - the task is registered into a local synchronised map using the
    opearation name as key
  - async response is returned (resulting into `HTTP 202 Accepted`
    response)
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

Successfully merging this pull request may close these issues.

1 participant