INT-4236: Status for SmartLifecycleRoleControlller

JIRA: https://jira.spring.io/browse/INT-4236

Add methods to obtain status from the `SmartLifecycleRoleController`.

* Polishing according PR comments.
* Fix log messages in the `SmartLifecycleRoleController` from the Zookeeper mentioning
This commit is contained in:
Gary Russell
2017-02-23 13:24:23 -05:00
committed by Artem Bilan
parent 257a2d3dab
commit f23360d539
4 changed files with 115 additions and 7 deletions

View File

@@ -633,6 +633,27 @@ start/stop its configured `SmartLifecycle` objects when leadership is granted/re
IMPORTANT: When using leadership election to start/stop components, it is important to set the `auto-startup` XML attribute (`autoStartup` bean property) to `false` so the application context does not start the components during context intialization.
Starting with _version 4.3.8, the `SmartLifecycleRoleController` provides several status methods:
[source, java]
----
public Collection<String> getRoles() <1>
public boolean allEndpointsRunning(String role) <2>
public boolean noEndpointsRunning(String role) <3>
public Map<String, Boolean> getEndpointsRunningStatus(String role) <4>
----
<1> Returns a list of the roles being managed.
<2> Returns true if all endpoints in the role are running.
<3> Returns true if none of the endpoints in the role are running.
<4> Returns a map of `component name : running status` - the component name is usually the bean name.
[[leadership-event-handling]]
=== Leadership Event Handling

View File

@@ -33,6 +33,9 @@ See <<annotations>> for more information.
All the request-reply endpoints (based on `AbstractReplyProducingMessageHandler`) can now start transaction and, therefore, make the whole downstream flow transactional.
See <<tx-handle-message-advice>> for more information.
The `SmartLifecycleRoleController` now provides methods to obtain status of endpoints in roles.
See <<endpoint-roles>> for more information.
==== JMS Changes
Previously, Spring Integration JMS XML configuration used a default bean name `connectionFactory` for the JMS Connection Factory, allowing the property to be omitted from component definitions.