Make writing a habit together! This is the 7th day of my participation in the “Gold Digging Day New Plan · April More text Challenge”. Click here for more details.
The preparatory work
Introduction to the
TubeMQ is an open source distributed messaging middleware that uses Protocol Bu o ffer for building a message object model. Open source on September 12, 2019, the day before Mid-Autumn Festival.
download
Install tools such as Git
- Simple and crude git pull directly
git clone https://github.com/Tencent/TubeM
Copy the code
Source structure
- The overall structure
- Structure definition
Visible support for Linux startup, packaged configurable, rich Demo.
The trial
The wheel test
compile
Click producer Demo to run, an error is reported:
Error: (26, 54) Java: package com. Tencent. Tubemq. Corebase. Protobuf. Generated does not existCopy the code
Found that the package should be in the core package, so global search for this class, unfortunately not. Global search, rpc. proto found the following:
option java_package = "com.tencent.tubemq.corebase.protobuf.generated";
option java_outer_classname = "RPCProtos";
option java_generate_equals_and_hash = true;
option optimize_for = SPEED;
Copy the code
Well, it’s gRPC syntax. Tubemq (2019 Mid-Autumn Festival) is not available in the central warehouse, so I compiled it myself. Start compiling, no surprises, daily error:
[ERROR] Failed to execute goal com.github. Igor-petruk. protobuf:protobuf-mavenplugin:0.6.3:run (default) on project Tubemq-core: Cannot execute 'protoc': Cannot run program "protoc": CreateProcess error=2, the system Cannot find the specified file. -> [Help 1]Copy the code
Find this plugin:
<p1ugin>
<groupId> com.github.igor-petruk.protobuf</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.3</version>
<executions>
<execution>
<phase>generate-sources </phase>
<goals>
<goa1>run</goa1>
</goals>
</execution>
</executions>
</plugin>
Copy the code
– No protoc program was found when the plugin was running, of course, I didn’t install it. Install the Protoc Windows edition.
Protocol Bu ff er
- Protocol Bu o ffers is a lightweight and efficient structured data storage format for serialization, or serialization, of structured data. It is well suited for data storage or RPC data exchange formats. A language-independent, platform-independent, extensible sequential structured data format that can be used in communication protocol, data storage and other fields. Currently provides C++, Java, Python three language API.
- You can see that TubeMQ also uses this format.
- Given the complexity of installing Protobuf on Windows, try compiling TubeMQ in a Linux environment.
- To check whether Maven exists, enter mvn-version. If Maven does not exist, install Maven
- Then download the TubeMQ source at the address above
compile
mvn clean compile
Copy the code
Same error, no protoc installed, expected ^_^
But Linux is much easier to install than Windows.
Install the protoc
Download it at 2.5.0 pan.baidu.com/s/1pJlZubT
Download 2.5.0, as TubeMQ is currently using the 2.5.0 JAR package. 2.6.1 pan.baidu.com/share/init?… Password: paju
After downloading, perform compilation, etc.
Sh configure --prefix=/usr/local/protobuf-2.6.1 make && make check && make installCopy the code
Execute command, —— after a long wait. Check whether the installation is successful
Configuring environment Variables
Installation complete.
- Error: MVN clean compile, but in the right direction, because the installed protoc version does not match:
- The version number of the protobuf-Java package in the project is 2.5.0. In the central repository, the version is actually 2013 ↓
You may need to install an environment version 2.5.0. At this time Liu Huan’s song sounded: “see success or failure of life heroic, just start all over again.” Then go again, download tar package 2.5.0, run the command, compile, “Long wait “(. – -) ZZZ omega left
<dependency> <groupId>com.sleepycat</groupId> <artifactId>je</artifactId> <version>5.0.73</version> <! -- tubemq-server.pop.xml -- add version --> </dependency>Copy the code
Bingo! The compilation succeeded.
mvn clean package
Copy the code
Start the
Server
- Package items, effects
- install
mvn clean install
Copy the code
- run
cd. / tubemq - server/target/tubemq - server - 3.8.0 - bin/tubemq - server - 3.8.0 / confGo to this directory and modify the configuration file
cd ../tubemq-server
sh bin/master.sh start # start
sh bin/broker.sh start # start
Copy the code
No error log is found during startup, to be continued