简单的记录下,项目中集成zbus的核心部分,做下简单的笔记,有误之处~还请指出
1.安装zbus,默认15555端口
2.客户端(生产者)
zbus配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<description>RPC服务</description>
<!-- 切换至高可用模式,只需要把broker的实现改为HaBroker配置 -->
<bean id="broker" class="org.zbus.broker.SingleBroker">
<constructor-arg>
<bean class="org.zbus.broker.BrokerConfig">
<property name="brokerAddress" value="${zbus.address}" />
<property name="maxTotal" value="20" />
</bean>
</constructor-arg>
</bean>
<bean id="wykRpcFactory" class="org.zbus.rpc.RpcFactory">
<constructor-arg>
<bean class="org.zbus.rpc.mq.MqInvoker">
<constructor-arg ref="broker" />
<constructor-arg value="WYK_RPC" />
</bean>
</constructor-arg>
</bean>
<!--rpc管理类-->
<bean id="accountRpcManager" class="com.wyk.rpc.account.manager.AccountRpcManager" init-method="initService"