Zbus = MQ + RPC + PROXY
- Support for Message Queuing, publish subscriptions, RPC, proxy (TCP/DMZ)
- Billion-tier message stacking capability, HA-enabled high availability
- Single jar package No dependency ~300k
- Service agent-adapting to transform existing business systems to provide cross-platform and language
- Rich Api--java/c/c++/c#/python/node.js Multi-language access
Zbus-dist Select zbus.sh or Zbus.bat to execute directly
Bus default occupies 15555 port, http://localhost:15555 can directly enter the monitoring, note Zbus because the native compatible HTTP protocol, so monitoring and Message Queuing use the same port
Zbus Role Summary
Zbus Message Communication Foundation (NET module)
The Zbus project is independent of other third-party libraries, and messaging is based on NIO completion (NET subproject). NET package to NiO made a concise package, relatively netty, the learning cost of a few levels, the model is simple, but without losing scalability.
Frame structure remains Dispatcher + N Selectorthread + ioadaptor
Dispatcher is responsible for managing N Selector Threads
Selectorthread responsible for NIO read-write event distribution
ioadaptor Personalized Read and write events
NET-based server program basically as long as care ioadaptor personalization, such as Zbus entrance is Mqadaptor
Zbus API
- Java API
- C + + API
- Python API
- C # API
- node. js API
Zbus PROXY
- Microsoft Msmq| Trading Dispatch
- Golden Card Kcxp
- China Letter Tc
- Bridging the Java Client
- Guotai Junan GTA
Zbus ExampleJava Maven Dependency
<dependency> <groupId>org.zbus</groupId> <artifactId>zbus</artifactId> <version>6.2.6</version></dependency>
producers
public static void Main (string[] args) throws Exception { //create broker proxy brokerconfig config = new Brokerconfig (); C3/>config.setserveraddress ("127.0.0.1:15555"); Final Broker broker = new Singlebroker (config); Producer Producer = new Producer (Broker, "MYMQ"); PRODUCER.CREATEMQ (); If it is determined that there is no need to create //Create a message, the body of the message can be any binary, and the application agreement is given to the user message msg = new Message (); Msg.setbody ("Hello World"); Producer.sendsync (msg); Broker.close ();}
Consumer
public static void Main (string[] args) throws exception{ //Create broker Rep brokerconfig Brokerconfig = new Brokerconfig (); Brokerconfig.setserveraddress ("127.0.0.1:15555"); Broker broker = new Singlebroker (brokerconfig); Mqconfig config = new Mqconfig (); Config.setbroker (broker); CONFIG.SETMQ ("Mymq"); Create consumer @SuppressWarnings ("resource") Consumer C = new Consumer (config); C.onmessage (New MessageHandler () { @Override public void handle (Message msg, Session sess) throws IOException { System.out.println (msg); } }); Start consumer thread C.start (); }
RPC Dynamic Agent "types of complex types"
Refer to the RPC section of the source test
1) Create broker representative (available with high available overrides) brokerconfig config = new Brokerconfig (); Config.setserveraddress ("127.0.0.1:15555"); Broker broker = new Singlebroker (config); 2) Create an MQ-based Invoker and RPC factory, specifying that RPC uses an MQ of Myrpc mqinvoker invoker = new Mqinvoker (Broker, "Myrpc"); Rpcfactory factory = new Rpcfactory (invoker); 3) Dynamic proxy out implementation class Interface hello = Factory.getservice (interface.class); Test (hello); Broker.close ();
Spring Integration--server side (RPC sample)
No code intrusion allows you to access your existing business interface to Zbus for cross-platform and multi-lingual support
<!--exposed Interface Implementation Example--><bean id= "interface" class= "Org.zbus.rpc.biz.InterfaceImpl" ></bean><bean ID = "Serviceprocessor" class= "Org.zbus.rpc.RpcProcessor" > <constructor-arg> <list> <!- -Put the exposed interface you need--<ref bean= "interface"/> </list> </CONSTRUCTOR-ARG></BEAN&G T;<bean id= "broker" class= "Org.zbus.broker.SingleBroker" > <constructor-arg> <bean class= "Org.zbus . Broker. Brokerconfig "> <property name=" serveraddress "value=" 127.0.0.1:15555 "/> <property name= "Maxtotal" value= "/>" <!--Here you can increase the connection pool parameter configuration, do not configure the use of default values (refer to Commons-pool2)-</bean> </ constructor-arg></bean><!--The Start method is called by default and is directly brought up by the spring container to register on the Zbus bus--><bean id= "Myrpcservice" class= "Org.zbus.rpc.mq.Service" init-method= "Start" > <constructor-arg> <bean class= "org.zbus.rpc.m Q.serviceconfig "> ≪! --Support for multi-bus registration-<constructor-arg> <list> <ref bean= "broker" /> </list> </constructor-arg> <property name= "MQ" value= "MYRPC"/ > <property name= "Consumercount" value= "2"/> <property name= "messageprocessor" ref= "Ser Viceprocessor "/> </bean> </constructor-arg></bean>
Spring Integration--Client
<bean id= "broker" class= "Org.zbus.broker.SingleBroker" > <constructor-arg> <bean class= " Org.zbus.broker.BrokerConfig "> <property name=" serveraddress "value=" 127.0.0.1:15555 "/> </ bean> </constructor-arg></bean><bean id= "Myrpc" class= "Org.zbus.rpc.RpcFactory" > <constructor-arg> <bean class= "Org.zbus.rpc.mq.MqInvoker" > <constructor-arg ref= "broker"/ > <constructor-arg value= "Myrpc"/> </bean> </constructor-arg></bean> <bean id= "interface" factory-bean= "Myrpc" factory-method= "GetService" >
Spring completes Zbus agent transparency, zbus facilities completely disappear from your application logic
public static void Main (string[] args) { ApplicationContext context = new Classpathxmlapplicationcontext (" Springrpcclient.xml "); Interface intf = (Interface) context.getbean ("Interface"); for (int i=0;i<100;i++) { System.out.println (Intf.listmap ());
Zbus Message Protocol
- Zbus high-level topic--agreement
zbus--lightweight MQ, RPC, service bus