From 7c12288d2eabb05da94cb10cbbfca678d87b589c Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 12 Oct 2016 11:21:11 -0400 Subject: [PATCH] GH-1928: Roles: Doc Polishing Fixes #1928 https://github.com/spring-projects/spring-integration/issues/1928 --- src/reference/asciidoc/endpoint.adoc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/reference/asciidoc/endpoint.adoc b/src/reference/asciidoc/endpoint.adoc index 4eef9ed6d7..14bc61ff23 100644 --- a/src/reference/asciidoc/endpoint.adoc +++ b/src/reference/asciidoc/endpoint.adoc @@ -584,7 +584,8 @@ You can assign endpoints to roles using XML, Java configuration, or programmatic [source, xml] ---- - + ---- @@ -592,7 +593,7 @@ You can assign endpoints to roles using XML, Java configuration, or programmatic [source, java] ---- @Bean -@ServiceActivator(inputChannel = "sendAsyncChannel") +@ServiceActivator(inputChannel = "sendAsyncChannel", autoStartup="false") @Role("cluster") public MessageHandler sendAsyncHandler() { return // some MessageHandler @@ -630,6 +631,8 @@ The `SmartLifecycleRoleController` implements `ApplicationListener>). -To participate in a leader election and be notified when elected leader or when leadership is revoked, an application creates a component in the application context called a "leader initiator". Normally a leader initiator is a `SmartLifecycle` so it starts up (optionally) automatically when the context starts, and then publishes notifications when leadership changes. By convention the user provides a `Candidate` that receives the callbacks and also can revoke the leadership through a `Context` object provided by the framework. User code can also listen for `AbstractLeaderEvents`, and respond accordingly, for instance using a `SmartLifecycleRoleController`. +To participate in a leader election and be notified when elected leader or when leadership is revoked, an application creates a component in the application context called a "leader initiator". +Normally a leader initiator is a `SmartLifecycle` so it starts up (optionally) automatically when the context starts, and then publishes notifications when leadership changes. +By convention the user provides a `Candidate` that receives the callbacks and also can revoke the leadership through a `Context` object provided by the framework. +User code can also listen for `AbstractLeaderEvents`, and respond accordingly, for instance using a `SmartLifecycleRoleController`. There is a basic implementation of a leader initiator based on the `LockRegistry` abstraction. To use it you just need to create an instance as a bean, for example: