Skip to content

Commit e8bb580

Browse files
authored
Merge pull request #5 from libxengine/develop
V2.0 merge
2 parents af83ced + 30f46cc commit e8bb580

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2052
-152
lines changed

README.en.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
This repository has a development and master branch. If you want to use it, please use the master branch
44

55
#### Description
6-
c c++消息队列服务 消息队列中间件
6+
c c++消息服务 消息中间件
77
c c++Message Queue Service
88

99
#### Software Architecture
1010
the software developed based on xengine,using c/c++ development
1111
the software is a simple and high performance server,Allow users to use it directly without secondary development
12-
the software mainly provides a message queue engine,support http,WEBSOCKET and private protocol api server
12+
the software mainly provides a message queue and dds engine,support http,WEBSOCKET and private protocol api server
1313

1414
## Software features
1515
this software support following features
@@ -27,6 +27,7 @@ this software support following features
2727
12. Active delivery acquisition mode or passive subscription notification module
2828
13. get order and start serial pos setting
2929
14. Unlimited load message types
30+
15. data distribution service(DDS),Support WAN and LAN
3031

3132
## install
3233

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
本仓库有开发和主分支,如果要使用,请使用master分支下的代码
44

55
## 介绍
6-
c c++消息队列服务 消息队列中间件
7-
c c++Message Queue Service
6+
c c++消息服务 消息中间件
7+
c c++Message Service
88

99
## 软件架构
1010
此软件基于XEngine开发.采用C/C++作为开发语言
1111
此软件是一款简易的高性能服务,统一的API接口,让用户几乎不需要二次开发就可以直接使用
12-
此软件主要是提供了消息队列引擎,可用于用户消息操作的一个API服务器.支持HTTP,WEBSOCKET和私有协议.
12+
此软件主要是提供了消息队列与消息分发引擎,可用于用户消息操作的一个API服务器.支持HTTP,WEBSOCKET和私有协议.
1313
## 软件特性
1414
此软件支持以下特性
1515
1. 消息序列
@@ -26,6 +26,7 @@ c c++Message Queue Service
2626
12. 主动投递获取模式或者被动订阅通知模块
2727
13. 获取顺序与开始序列号设置
2828
14. 不限制负载的消息类型
29+
15. 消息分发服务(DDS),支持广域网和局域网
2930

3031
## 安装教程
3132

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#ifdef _MSC_BUILD
2+
#include <Windows.h>
3+
#include <tchar.h>
4+
#include <json/json.h>
5+
#pragma comment(lib,"Ws2_32")
6+
#pragma comment(lib,"XEngine_Core/XEngine_Core")
7+
#pragma comment(lib,"../../XEngine_Source/Debug/MQCore_ProtocolModule")
8+
#endif
9+
#include <stdio.h>
10+
#include <stdlib.h>
11+
#include <string.h>
12+
#include <thread>
13+
#include <XEngine_Include/XEngine_CommHdr.h>
14+
#include <XEngine_Include/XEngine_ProtocolHdr.h>
15+
#include <XEngine_Include/XEngine_Core/NetCore_Define.h>
16+
#include <XEngine_Include/XEngine_Core/NetCore_Error.h>
17+
#include "../../XEngine_Source/XQueue_ProtocolHdr.h"
18+
#include "../../XEngine_Source/MQCore_ProtocolModule/Protocol_Define.h"
19+
#include "../../XEngine_Source/MQCore_ProtocolModule/Protocol_Error.h"
20+
21+
//g++ -std=c++17 -Wall -g MQCore_DDSPublish.cpp -o MQCore_DDSPublish.exe -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_Core -L ../../XEngine_Source/MQCore_ProtocolModule -lXEngine_BaseLib -lXEngine_Core -lMQCore_ProtocolModule -ljsoncpp
22+
23+
SOCKET m_Socket;
24+
LPCTSTR lpszKey = _T("XEngine_Notify"); //主题
25+
LPCTSTR lpszIPAddr = _T("192.168.1.7");
26+
LPCTSTR lpszGroupAddr = _T("224.0.2.100");
27+
28+
#define XENGINE_MQCORE_DDSPUBLISH_ENABLE_MULTI 1
29+
30+
int main()
31+
{
32+
#ifdef _MSC_BUILD
33+
WSADATA st_WSAData;
34+
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
35+
#endif
36+
int nMsgLen = 0;
37+
XNETHANDLE xhClient = 0;
38+
TCHAR tszMsgBuffer[2048];
39+
XENGINE_PROTOCOL_XDDS st_DDSProtocol;
40+
41+
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
42+
memset(&st_DDSProtocol, '\0', sizeof(XENGINE_PROTOCOL_XDDS));
43+
//创建发布者
44+
st_DDSProtocol.bCreater = TRUE;
45+
st_DDSProtocol.bTcp = FALSE;
46+
st_DDSProtocol.nPort = 10000;
47+
_tcscpy(st_DDSProtocol.tszTopic, lpszKey);
48+
49+
if (st_DDSProtocol.bTcp)
50+
{
51+
_tcscpy(st_DDSProtocol.tszDDSAddr, lpszIPAddr);
52+
//创建服务器
53+
if (!NetCore_TCPSelect_StartEx(&xhClient, st_DDSProtocol.nPort))
54+
{
55+
printf("NetCore_TCPSelect_StartEx:error\n");
56+
return -1;
57+
}
58+
}
59+
else
60+
{
61+
_tcscpy(st_DDSProtocol.tszDDSAddr, lpszGroupAddr);
62+
//初始化组播发送服务
63+
if (!NetCore_GroupCast_SDCreate((SOCKET*)&xhClient, st_DDSProtocol.tszDDSAddr, st_DDSProtocol.nPort))
64+
{
65+
printf("NetCore_GroupCast_SDCreate:error\n");
66+
return -1;
67+
}
68+
}
69+
//发送请求给服务端
70+
#ifdef XENGINE_MQCORE_DDSPUBLISH_ENABLE_MULTI
71+
SOCKET hSDSocket;
72+
SOCKET hRVSocket;
73+
NetCore_BroadCast_SendInit(&hSDSocket, 5210, lpszIPAddr);
74+
NetCore_BroadCast_RecvInit(&hRVSocket, 5211);
75+
76+
ProtocolModule_Packet_DDSTopic(&st_DDSProtocol, tszMsgBuffer, &nMsgLen, XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_DDS_REQTOPICCREATE);
77+
NetCore_BroadCast_Send(hSDSocket, tszMsgBuffer, nMsgLen);
78+
79+
NetCore_BroadCast_Recv(hRVSocket, tszMsgBuffer, &nMsgLen);
80+
NetCore_BroadCast_Close(hSDSocket);
81+
NetCore_BroadCast_Close(hRVSocket);
82+
#endif
83+
84+
while (1)
85+
{
86+
//发送数据
87+
if (st_DDSProtocol.bTcp)
88+
{
89+
if (!NetCore_TCPSelect_SendAllEx(xhClient, "hello", 5))
90+
{
91+
printf("NetCore_TCPSelect_StartEx:error\n");
92+
return -1;
93+
}
94+
}
95+
else
96+
{
97+
if (!NetCore_GroupCast_SDend((SOCKET)xhClient, "hello", 5))
98+
{
99+
printf("NetCore_GroupCast_SDCreate:error\n");
100+
return -1;
101+
}
102+
}
103+
printf("1\n");
104+
std::this_thread::sleep_for(std::chrono::seconds(1));
105+
}
106+
107+
#ifdef _MSC_BUILD
108+
WSACleanup();
109+
#endif
110+
return 0;
111+
}
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>16.0</VCProjectVersion>
23+
<Keyword>Win32Proj</Keyword>
24+
<ProjectGuid>{f327eef0-e6f0-4c12-a85a-eaacabbf70d8}</ProjectGuid>
25+
<RootNamespace>MQCoreDDSPublish</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>Application</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v142</PlatformToolset>
33+
<CharacterSet>MultiByte</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>Application</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v142</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>Application</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v142</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>Application</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v142</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<LinkIncremental>true</LinkIncremental>
75+
<IncludePath>$(XEngine_Include);$(IncludePath)</IncludePath>
76+
<LibraryPath>$(XEngine_Lib32);$(LibraryPath)</LibraryPath>
77+
</PropertyGroup>
78+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
79+
<LinkIncremental>false</LinkIncremental>
80+
</PropertyGroup>
81+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
82+
<LinkIncremental>true</LinkIncremental>
83+
</PropertyGroup>
84+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
85+
<LinkIncremental>false</LinkIncremental>
86+
</PropertyGroup>
87+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
88+
<ClCompile>
89+
<WarningLevel>Level3</WarningLevel>
90+
<SDLCheck>true</SDLCheck>
91+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92+
<ConformanceMode>true</ConformanceMode>
93+
</ClCompile>
94+
<Link>
95+
<SubSystem>Console</SubSystem>
96+
<GenerateDebugInformation>true</GenerateDebugInformation>
97+
</Link>
98+
</ItemDefinitionGroup>
99+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
100+
<ClCompile>
101+
<WarningLevel>Level3</WarningLevel>
102+
<FunctionLevelLinking>true</FunctionLevelLinking>
103+
<IntrinsicFunctions>true</IntrinsicFunctions>
104+
<SDLCheck>true</SDLCheck>
105+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
106+
<ConformanceMode>true</ConformanceMode>
107+
</ClCompile>
108+
<Link>
109+
<SubSystem>Console</SubSystem>
110+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
111+
<OptimizeReferences>true</OptimizeReferences>
112+
<GenerateDebugInformation>true</GenerateDebugInformation>
113+
</Link>
114+
</ItemDefinitionGroup>
115+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
116+
<ClCompile>
117+
<WarningLevel>Level3</WarningLevel>
118+
<SDLCheck>true</SDLCheck>
119+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
120+
<ConformanceMode>true</ConformanceMode>
121+
</ClCompile>
122+
<Link>
123+
<SubSystem>Console</SubSystem>
124+
<GenerateDebugInformation>true</GenerateDebugInformation>
125+
</Link>
126+
</ItemDefinitionGroup>
127+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
128+
<ClCompile>
129+
<WarningLevel>Level3</WarningLevel>
130+
<FunctionLevelLinking>true</FunctionLevelLinking>
131+
<IntrinsicFunctions>true</IntrinsicFunctions>
132+
<SDLCheck>true</SDLCheck>
133+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
134+
<ConformanceMode>true</ConformanceMode>
135+
</ClCompile>
136+
<Link>
137+
<SubSystem>Console</SubSystem>
138+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
139+
<OptimizeReferences>true</OptimizeReferences>
140+
<GenerateDebugInformation>true</GenerateDebugInformation>
141+
</Link>
142+
</ItemDefinitionGroup>
143+
<ItemGroup>
144+
<ClCompile Include="MQCore_DDSPublish.cpp" />
145+
</ItemGroup>
146+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
147+
<ImportGroup Label="ExtensionTargets">
148+
</ImportGroup>
149+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="源文件">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="头文件">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="资源文件">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="MQCore_DDSPublish.cpp">
19+
<Filter>源文件</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

0 commit comments

Comments
 (0)