Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Zookeeper Leader Election
<bean id="leaderElectionProxyTemplate" class="org.springframework.aop.framework.ProxyFactoryBean"
abstract="true">
<property name="interceptorNames">
<list>
<value>leaderElectionTarget</value>
</list>
</property>
</bean>
<bean id="leaderElectionTarget" class="org.projectx.zookeeper.election.LeaderElectionTargetInterceptor" />
<bean id="myService" parent="leaderElectionProxyTemplate">
<property name="target">
<bean class="org.projetx.service.MyService">
</property>
</bean>
<bean id="leaderElectionTarget"
class="org.projectx.zookeeper.election.quartz.SchedulerElectionTarget">
<constructor-arg ref="myScheduler" />
</bean>
<bean id="presenceNodeFactory" class="org.projectx.zookeeper.presence.PresenceNodeFactory">
<constructor-arg ref="zookeeperTemplate" />
<constructor-arg value="/projectx/services/prod" />
<constructor-arg value="${zookeeper.entity.name}" />
<constructor-arg ref="serviceMetaDataProvider" />
</bean>
<bean id="presenceManager" class="org.projectx.zookeeper.presence.PresenceManager">
<constructor-arg ref="presenceNodeFactory" />
</bean>
<bean id="serviceMetaDataProvider"
class="org.projectx.zookeeper.presence.ServiceMetaDataProvider">
<constructor-arg value="${zookeeper.entity.name}" />
</bean>
<bean id="zkClient" class="org.projectx.zookeeper.ZkClientFactoryBean">
<property name="ensemble" value="localhost:2181,localhost:2182,localhost:2183" />
<property name="connectionTimeout" value="2000" />
<property name="sessionTimeout" value="10000" />
<property name="stateListeners">
<list>
<ref local="zkStatsCollector" />
</list>
</property>
</bean>
<bean id="zkStatsCollector" class="org.projectx.zookeeper.ZookeeperClientStatsCollector" />
<bean id="zkTemplate" class="org.projectx.zookeeper.ZookeeperTemplate">
<constructor-arg ref="zkClient" />
</bean>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.