INT-4361: Add a role() hook to Java DSL
JIRA: https://jira.spring.io/browse/INT-4361 * To get a gain of the method chain code flow and avoid extra annotation parsing, add `.role(String)` hook to the `EndpointSpec` * Delegate the provided `role` property to the `AbstractEndpoint` * Register `AbstractEndpoint` as itself `SmartLifecycle` in the `SmartLifecycleRoleController` * Add `destroy()` to the `AbstractEndpoint` and remove it from the `SmartLifecycleRoleController` * Provide some Java 8 code style refactoring * Rework XML parsers and Annotation processors to populate `role` property on the `AbstractEndpoint` * Wrap `roleController` bean extraction to the `NoSuchBeanDefinitionException` catch * Fix several `AbstractEndpoint` implementation to properly call `super.onInit()` which has been missed before
This commit is contained in:
committed by
Gary Russell
parent
a61327766e
commit
f7e75223c7
@@ -653,6 +653,12 @@ private SmartLifecycleRoleController roleController;
|
||||
...
|
||||
----
|
||||
|
||||
[source, java]
|
||||
----
|
||||
IntegrationFlow flow -> flow
|
||||
.handle(..., e -> e.role("cluster"));
|
||||
----
|
||||
|
||||
Each of these adds the endpoint to the role `cluster`.
|
||||
|
||||
Invoking `roleController.startLifecyclesInRole("cluster")` (and the corresponding `stop...` method) will start/stop
|
||||
|
||||
Reference in New Issue
Block a user