Add better failure analysis feedback for missing configuration
Provide an option to configure an app broker application by using the annotation @EnableAppBroker. Using this annotation will also activate @EnableOpenServiceBroker
If this annotation is present, the application context will fail to start if required beans or properties are not present. This will help developers diagnose misconfigured applications or tests
See https://github.com/spring-cloud/spring-cloud-config/blob/master/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/EnableConfigServer.java for an example of this approach
We decided on to configure faster failing instead of an annotation for Spring Cloud Open Service Broker autoconfiguration. @ojhughes This issue is a bit dated now. Do you still value an annotation approach for app broker? Or should we consider modifying the autoconfiguration? Or is it failing early enough that this is no longer needed?
I don't mind if it is an annotation or not. The issue still stands because if no implementation of ServiceInstanceService is found, then the OSB endpoints are not loaded but no error or warning is provided. Maybe the answer is to load a no-op ServiceInstanceService when there is OSB catalog configuration?
I thought we had handled this issue in https://github.com/spring-cloud/spring-cloud-open-service-broker/commit/efb098ffa9cd95d6001d9bd0676d313d70a10045. It should be failing faster now when required beans are missing. What am I missing?
The problem I had was that the catalog endpoints were present and correct but the other service_instance endpoints were missing which made the test very difficult to debug
ah.. ok. I'll look at that. Thanks.
The issue still stands because if no implementation of
ServiceInstanceServiceis found, then the OSB endpoints are not loaded but no error or warning is provided. Maybe the answer is to load a no-op ServiceInstanceService when there is OSB catalog configuration?
I'm not sure I understand still.
If you are using SC OSB, there is no default implementation of ServiceInstanceService and the broker app should fail to start without an app-provided implementation (with the changes @royclarkson linked to above). If something still isn't right there, that should be an SC OSB issue.
If you are using App Broker, there is a provided WorkflowServiceInstanceService that implements the ServiceInstanceService interface. The WorkflowServiceInstanceService has required bean dependencies [Create|Delete|Update]ServiceInstanceWorkflow with default implementations for app deployment. So the "no implementation of ServiceInstanceService is found" condition should never happen.
What could happen is a broker deployed with a catalog that advertises services but no App Broker configured actions for the advertised services. We'd have to think about how to validate this, as it's possible for e.g. the catalog to advertise two services, one handled by App Broker via configuration and the other handled by the broker app via custom [Create|Delete|Update]ServiceInstanceWorkflow logic.
@ojhughes any thoughts on Scott's comments?
I recently added better failure analysis in SCOSB. This is the recommended approach for failing fast with Spring Boot auto-configuration. Let's capture potential scenarios for app broker and incorporate similar functionality.