food-waimqi-mq
parent
9863a77cc8
commit
419b41a69b
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>package</id>
|
||||
<formats>
|
||||
<format>dir</format>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/bin</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<includes>
|
||||
<include>application.properties</include>
|
||||
<include>logback.xml</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/conf</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/logs</directory>
|
||||
<outputDirectory>logs</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/lib</directory>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/temp</directory>
|
||||
<outputDirectory>temp</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>${project.build.directory}/${artifactId}-${version}.jar</source>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<destName>${artifactId}-${version}.jar</destName>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.jwsaas</groupId>
|
||||
<artifactId>food-parent</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>food-waimai-mq</artifactId>
|
||||
|
||||
<name>food-waimai-mq</name>
|
||||
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
<spring-boot.version>2.0.8.RELEASE</spring-boot.version>
|
||||
<dubbo-spring-boot-starter.version>0.2.0</dubbo-spring-boot-starter.version>
|
||||
<!-- MQTT Client -->
|
||||
<mqttv3.version>1.2.0</mqttv3.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<!-- dubbo -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.boot</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
<version>${dubbo-spring-boot-starter.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.jboss.netty</groupId>
|
||||
<artifactId>netty</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
<version>2.6.5</version><!-- 2.6.4 -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.jboss.netty</groupId>
|
||||
<artifactId>netty</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.spring</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
<!-- curator -->
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-client</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-framework</artifactId>
|
||||
<version>4.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-handler</artifactId>
|
||||
</dependency>
|
||||
<!-- jwsaas -->
|
||||
<dependency>
|
||||
<groupId>com.jwsaas</groupId>
|
||||
<artifactId>common-utils</artifactId>
|
||||
</dependency>
|
||||
<!-- foodv2 -->
|
||||
<dependency>
|
||||
<groupId>com.jwsaas</groupId>
|
||||
<artifactId>food-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MQTT Client -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>${mqttv3.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>application.properties</exclude>
|
||||
<exclude>logback.xml</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,140 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem
|
||||
rem Copyright (c) 1999, 2016 Tanuki Software, Ltd.
|
||||
rem http://www.tanukisoftware.com
|
||||
rem All rights reserved.
|
||||
rem
|
||||
rem This software is the proprietary information of Tanuki Software.
|
||||
rem You shall use it only in accordance with the terms of the
|
||||
rem license agreement you entered into with Tanuki Software.
|
||||
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||
rem
|
||||
rem Java Service Wrapper general passthrough startup script.
|
||||
rem
|
||||
|
||||
rem -----------------------------------------------------------------------------
|
||||
rem These settings can be modified to fit the needs of your application
|
||||
rem Optimized for use with version 3.5.28 of the Wrapper.
|
||||
|
||||
rem The base name for the Wrapper binary.
|
||||
set _WRAPPER_BASE=wrapper
|
||||
|
||||
rem The directory where the Wrapper binary (.exe) file is located. It can be
|
||||
rem either an absolute or a relative path. If the path contains any special
|
||||
rem characters, please make sure to quote the variable.
|
||||
set _WRAPPER_DIR=
|
||||
|
||||
rem The name and location of the Wrapper configuration file. This will be used
|
||||
rem if the user does not specify a configuration file as the first parameter to
|
||||
rem this script.
|
||||
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
|
||||
|
||||
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||
rem as the first parameter.
|
||||
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||
|
||||
rem _PASS_THROUGH tells the script to pass all parameters through to the JVM
|
||||
rem as is.
|
||||
rem If _WRAPPER_CONF_OVERRIDE is specified then all parameters will be passed.
|
||||
rem If not set then all parameters starting with the second will be passed.
|
||||
set _PASS_THROUGH=true
|
||||
|
||||
rem Do not modify anything beyond this point
|
||||
rem -----------------------------------------------------------------------------
|
||||
|
||||
rem
|
||||
rem Resolve the real path of the wrapper.exe
|
||||
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||
rem can be hard-coded below and the following test removed.
|
||||
rem
|
||||
if "%OS%"=="Windows_NT" goto nt
|
||||
echo This script only works with NT-based versions of Windows.
|
||||
goto :eof
|
||||
|
||||
:nt
|
||||
rem Find the application home.
|
||||
rem if no path path specified do the default action
|
||||
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||
rem check if absolute path
|
||||
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||
rem everythig else means relative path
|
||||
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||
goto pathfound
|
||||
|
||||
:dir_undefined
|
||||
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||
set _REALPATH="%~dp0"
|
||||
goto pathfound
|
||||
:absolute_path
|
||||
rem Use an absolute path to the wrapper
|
||||
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||
|
||||
:pathfound
|
||||
rem
|
||||
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||
rem
|
||||
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||
goto search
|
||||
:amd64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||
goto search
|
||||
:ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||
goto search
|
||||
:search
|
||||
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
echo Unable to locate a Wrapper executable using any of the following names:
|
||||
echo %_WRAPPER_L_EXE%
|
||||
echo %_WRAPPER_EXE%
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
rem
|
||||
rem Find the wrapper.conf
|
||||
rem
|
||||
:conf
|
||||
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not [%_WRAPPER_CONF%]==[""] (
|
||||
shift
|
||||
goto :startup
|
||||
)
|
||||
)
|
||||
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||
|
||||
rem
|
||||
rem Start the Wrapper
|
||||
rem
|
||||
:startup
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
if not [%1]==[] (
|
||||
echo WARNING: Extra arguments will be ignored. Please check usage in the batch file.
|
||||
)
|
||||
)
|
||||
|
||||
rem Collect the application parameters
|
||||
:parameters
|
||||
set _PARAMETERS=%_PARAMETERS% %1
|
||||
shift
|
||||
if not [%1]==[] goto :parameters
|
||||
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
%_WRAPPER_EXE% -i %_WRAPPER_CONF%
|
||||
) else (
|
||||
%_WRAPPER_EXE% -i %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||
)
|
||||
if not errorlevel 1 goto :eof
|
||||
pause
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,135 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem
|
||||
rem Copyright (c) 1999, 2016 Tanuki Software, Ltd.
|
||||
rem http://www.tanukisoftware.com
|
||||
rem All rights reserved.
|
||||
rem
|
||||
rem This software is the proprietary information of Tanuki Software.
|
||||
rem You shall use it only in accordance with the terms of the
|
||||
rem license agreement you entered into with Tanuki Software.
|
||||
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||
rem
|
||||
rem Java Service Wrapper general startup script.
|
||||
rem
|
||||
|
||||
rem -----------------------------------------------------------------------------
|
||||
rem These settings can be modified to fit the needs of your application
|
||||
rem Optimized for use with version 3.5.28 of the Wrapper.
|
||||
|
||||
rem The base name for the Wrapper binary.
|
||||
set _WRAPPER_BASE=wrapper
|
||||
|
||||
rem The directory where the Wrapper binary (.exe) file is located. It can be
|
||||
rem either an absolute or a relative path. If the path contains any special
|
||||
rem characters, please make sure to quote the variable.
|
||||
set _WRAPPER_DIR=
|
||||
|
||||
rem The name and location of the Wrapper configuration file. This will be used
|
||||
rem if the user does not specify a configuration file as the first parameter to
|
||||
rem this script.
|
||||
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
|
||||
|
||||
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||
rem as the first parameter.
|
||||
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||
|
||||
rem Note that it is only possible to pass parameters through to the JVM when
|
||||
rem installing the service, or when running in a console.
|
||||
|
||||
rem Do not modify anything beyond this point
|
||||
rem -----------------------------------------------------------------------------
|
||||
|
||||
rem
|
||||
rem Resolve the real path of the wrapper.exe
|
||||
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||
rem can be hard-coded below and the following test removed.
|
||||
rem
|
||||
if "%OS%"=="Windows_NT" goto nt
|
||||
echo This script only works with NT-based versions of Windows.
|
||||
goto :eof
|
||||
|
||||
:nt
|
||||
rem Find the application home.
|
||||
rem if no path path specified do the default action
|
||||
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||
rem check if absolute path
|
||||
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||
rem everythig else means relative path
|
||||
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||
goto pathfound
|
||||
|
||||
:dir_undefined
|
||||
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||
set _REALPATH="%~dp0"
|
||||
goto pathfound
|
||||
:absolute_path
|
||||
rem Use an absolute path to the wrapper
|
||||
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||
|
||||
:pathfound
|
||||
rem
|
||||
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||
rem
|
||||
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||
goto search
|
||||
:amd64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||
goto search
|
||||
:ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||
goto search
|
||||
:search
|
||||
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
echo Unable to locate a Wrapper executable using any of the following names:
|
||||
echo %_WRAPPER_L_EXE%
|
||||
echo %_WRAPPER_EXE%
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
rem
|
||||
rem Find the wrapper.conf
|
||||
rem
|
||||
:conf
|
||||
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not [%_WRAPPER_CONF%]==[""] (
|
||||
shift
|
||||
goto :startup
|
||||
)
|
||||
)
|
||||
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||
|
||||
rem
|
||||
rem Start the Wrapper
|
||||
rem
|
||||
:startup
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
if not [%1]==[] (
|
||||
echo WARNING: Extra arguments will be ignored. Please check usage in the batch file.
|
||||
)
|
||||
)
|
||||
|
||||
rem Collect the application parameters
|
||||
:parameters
|
||||
set _PARAMETERS=%_PARAMETERS% %1
|
||||
shift
|
||||
if not [%1]==[] goto :parameters
|
||||
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
%_WRAPPER_EXE% -a %_WRAPPER_CONF%
|
||||
) else (
|
||||
%_WRAPPER_EXE% -a %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||
)
|
||||
if not errorlevel 1 goto :eof
|
||||
pause
|
@ -0,0 +1,135 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem
|
||||
rem Copyright (c) 1999, 2016 Tanuki Software, Ltd.
|
||||
rem http://www.tanukisoftware.com
|
||||
rem All rights reserved.
|
||||
rem
|
||||
rem This software is the proprietary information of Tanuki Software.
|
||||
rem You shall use it only in accordance with the terms of the
|
||||
rem license agreement you entered into with Tanuki Software.
|
||||
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||
rem
|
||||
rem Java Service Wrapper general startup script.
|
||||
rem
|
||||
|
||||
rem -----------------------------------------------------------------------------
|
||||
rem These settings can be modified to fit the needs of your application
|
||||
rem Optimized for use with version 3.5.28 of the Wrapper.
|
||||
|
||||
rem The base name for the Wrapper binary.
|
||||
set _WRAPPER_BASE=wrapper
|
||||
|
||||
rem The directory where the Wrapper binary (.exe) file is located. It can be
|
||||
rem either an absolute or a relative path. If the path contains any special
|
||||
rem characters, please make sure to quote the variable.
|
||||
set _WRAPPER_DIR=
|
||||
|
||||
rem The name and location of the Wrapper configuration file. This will be used
|
||||
rem if the user does not specify a configuration file as the first parameter to
|
||||
rem this script.
|
||||
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
|
||||
|
||||
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||
rem as the first parameter.
|
||||
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||
|
||||
rem Note that it is only possible to pass parameters through to the JVM when
|
||||
rem installing the service, or when running in a console.
|
||||
|
||||
rem Do not modify anything beyond this point
|
||||
rem -----------------------------------------------------------------------------
|
||||
|
||||
rem
|
||||
rem Resolve the real path of the wrapper.exe
|
||||
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||
rem can be hard-coded below and the following test removed.
|
||||
rem
|
||||
if "%OS%"=="Windows_NT" goto nt
|
||||
echo This script only works with NT-based versions of Windows.
|
||||
goto :eof
|
||||
|
||||
:nt
|
||||
rem Find the application home.
|
||||
rem if no path path specified do the default action
|
||||
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||
rem check if absolute path
|
||||
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||
rem everythig else means relative path
|
||||
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||
goto pathfound
|
||||
|
||||
:dir_undefined
|
||||
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||
set _REALPATH="%~dp0"
|
||||
goto pathfound
|
||||
:absolute_path
|
||||
rem Use an absolute path to the wrapper
|
||||
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||
|
||||
:pathfound
|
||||
rem
|
||||
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||
rem
|
||||
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||
goto search
|
||||
:amd64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||
goto search
|
||||
:ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||
goto search
|
||||
:search
|
||||
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
echo Unable to locate a Wrapper executable using any of the following names:
|
||||
echo %_WRAPPER_L_EXE%
|
||||
echo %_WRAPPER_EXE%
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
rem
|
||||
rem Find the wrapper.conf
|
||||
rem
|
||||
:conf
|
||||
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not [%_WRAPPER_CONF%]==[""] (
|
||||
shift
|
||||
goto :startup
|
||||
)
|
||||
)
|
||||
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||
|
||||
rem
|
||||
rem Start the Wrapper
|
||||
rem
|
||||
:startup
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
if not [%1]==[] (
|
||||
echo WARNING: Extra arguments will be ignored. Please check usage in the batch file.
|
||||
)
|
||||
)
|
||||
|
||||
rem Collect the application parameters
|
||||
:parameters
|
||||
set _PARAMETERS=%_PARAMETERS% %1
|
||||
shift
|
||||
if not [%1]==[] goto :parameters
|
||||
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
%_WRAPPER_EXE% -q %_WRAPPER_CONF%
|
||||
) else (
|
||||
%_WRAPPER_EXE% -q %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||
)
|
||||
if not errorlevel 1 goto :eof
|
||||
pause
|
@ -0,0 +1,135 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem
|
||||
rem Copyright (c) 1999, 2016 Tanuki Software, Ltd.
|
||||
rem http://www.tanukisoftware.com
|
||||
rem All rights reserved.
|
||||
rem
|
||||
rem This software is the proprietary information of Tanuki Software.
|
||||
rem You shall use it only in accordance with the terms of the
|
||||
rem license agreement you entered into with Tanuki Software.
|
||||
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||
rem
|
||||
rem Java Service Wrapper general startup script.
|
||||
rem
|
||||
|
||||
rem -----------------------------------------------------------------------------
|
||||
rem These settings can be modified to fit the needs of your application
|
||||
rem Optimized for use with version 3.5.28 of the Wrapper.
|
||||
|
||||
rem The base name for the Wrapper binary.
|
||||
set _WRAPPER_BASE=wrapper
|
||||
|
||||
rem The directory where the Wrapper binary (.exe) file is located. It can be
|
||||
rem either an absolute or a relative path. If the path contains any special
|
||||
rem characters, please make sure to quote the variable.
|
||||
set _WRAPPER_DIR=
|
||||
|
||||
rem The name and location of the Wrapper configuration file. This will be used
|
||||
rem if the user does not specify a configuration file as the first parameter to
|
||||
rem this script.
|
||||
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
|
||||
|
||||
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||
rem as the first parameter.
|
||||
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||
|
||||
rem Note that it is only possible to pass parameters through to the JVM when
|
||||
rem installing the service, or when running in a console.
|
||||
|
||||
rem Do not modify anything beyond this point
|
||||
rem -----------------------------------------------------------------------------
|
||||
|
||||
rem
|
||||
rem Resolve the real path of the wrapper.exe
|
||||
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||
rem can be hard-coded below and the following test removed.
|
||||
rem
|
||||
if "%OS%"=="Windows_NT" goto nt
|
||||
echo This script only works with NT-based versions of Windows.
|
||||
goto :eof
|
||||
|
||||
:nt
|
||||
rem Find the application home.
|
||||
rem if no path path specified do the default action
|
||||
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||
rem check if absolute path
|
||||
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||
rem everythig else means relative path
|
||||
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||
goto pathfound
|
||||
|
||||
:dir_undefined
|
||||
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||
set _REALPATH="%~dp0"
|
||||
goto pathfound
|
||||
:absolute_path
|
||||
rem Use an absolute path to the wrapper
|
||||
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||
|
||||
:pathfound
|
||||
rem
|
||||
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||
rem
|
||||
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||
goto search
|
||||
:amd64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||
goto search
|
||||
:ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||
goto search
|
||||
:search
|
||||
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
echo Unable to locate a Wrapper executable using any of the following names:
|
||||
echo %_WRAPPER_L_EXE%
|
||||
echo %_WRAPPER_EXE%
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
rem
|
||||
rem Find the wrapper.conf
|
||||
rem
|
||||
:conf
|
||||
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not [%_WRAPPER_CONF%]==[""] (
|
||||
shift
|
||||
goto :startup
|
||||
)
|
||||
)
|
||||
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||
|
||||
rem
|
||||
rem Start the Wrapper
|
||||
rem
|
||||
:startup
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
if not [%1]==[] (
|
||||
echo WARNING: Extra arguments will be ignored. Please check usage in the batch file.
|
||||
)
|
||||
)
|
||||
|
||||
rem Collect the application parameters
|
||||
:parameters
|
||||
set _PARAMETERS=%_PARAMETERS% %1
|
||||
shift
|
||||
if not [%1]==[] goto :parameters
|
||||
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
%_WRAPPER_EXE% -e %_WRAPPER_CONF%
|
||||
) else (
|
||||
%_WRAPPER_EXE% -e %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||
)
|
||||
if not errorlevel 1 goto :eof
|
||||
pause
|
@ -0,0 +1,156 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem
|
||||
rem Copyright (c) 1999, 2016 Tanuki Software, Ltd.
|
||||
rem http://www.tanukisoftware.com
|
||||
rem All rights reserved.
|
||||
rem
|
||||
rem This software is the proprietary information of Tanuki Software.
|
||||
rem You shall use it only in accordance with the terms of the
|
||||
rem license agreement you entered into with Tanuki Software.
|
||||
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||
rem
|
||||
rem Java Service Wrapper general passthrough startup script.
|
||||
rem
|
||||
|
||||
rem -----------------------------------------------------------------------------
|
||||
rem These settings can be modified to fit the needs of your application
|
||||
rem Optimized for use with version 3.5.28 of the Wrapper.
|
||||
rem
|
||||
rem ********************************************************************
|
||||
rem NOTE - This script has been modified to run the TestWrapper sample
|
||||
rem application and should NOT be used as a base for your own
|
||||
rem applications. All of the documentation assumes that you are
|
||||
rem working from the default source script:
|
||||
rem WRAPPER_HOME/src/bin/App.bat.in
|
||||
rem ********************************************************************
|
||||
rem
|
||||
rem ********************************************************************
|
||||
rem NOTE - This script has been modified to run the TestWrapper sample
|
||||
rem application and should NOT be used as a base for your own
|
||||
rem applications. All of the documentation assumes that you are
|
||||
rem working from the default source script:
|
||||
rem WRAPPER_HOME/src/bin/App.bat.in
|
||||
rem ********************************************************************
|
||||
|
||||
rem The base name for the Wrapper binary.
|
||||
set _WRAPPER_BASE=wrapper
|
||||
|
||||
rem The directory where the Wrapper binary (.exe) file is located. It can be
|
||||
rem either an absolute or a relative path. If the path contains any special
|
||||
rem characters, please make sure to quote the variable.
|
||||
set _WRAPPER_DIR=
|
||||
|
||||
rem The name and location of the Wrapper configuration file. This will be used
|
||||
rem if the user does not specify a configuration file as the first parameter to
|
||||
rem this script.
|
||||
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
|
||||
|
||||
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||
rem as the first parameter.
|
||||
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||
|
||||
rem _PASS_THROUGH tells the script to pass all parameters through to the JVM
|
||||
rem as is.
|
||||
rem If _WRAPPER_CONF_OVERRIDE is specified then all parameters will be passed.
|
||||
rem If not set then all parameters starting with the second will be passed.
|
||||
set _PASS_THROUGH=true
|
||||
|
||||
rem Do not modify anything beyond this point
|
||||
rem -----------------------------------------------------------------------------
|
||||
|
||||
rem
|
||||
rem Resolve the real path of the wrapper.exe
|
||||
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||
rem can be hard-coded below and the following test removed.
|
||||
rem
|
||||
if "%OS%"=="Windows_NT" goto nt
|
||||
echo This script only works with NT-based versions of Windows.
|
||||
goto :eof
|
||||
|
||||
:nt
|
||||
rem Find the application home.
|
||||
rem if no path path specified do the default action
|
||||
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||
rem check if absolute path
|
||||
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||
rem everythig else means relative path
|
||||
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||
goto pathfound
|
||||
|
||||
:dir_undefined
|
||||
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||
set _REALPATH="%~dp0"
|
||||
goto pathfound
|
||||
:absolute_path
|
||||
rem Use an absolute path to the wrapper
|
||||
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||
|
||||
:pathfound
|
||||
rem
|
||||
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||
rem
|
||||
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||
goto search
|
||||
:amd64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||
goto search
|
||||
:ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||
goto search
|
||||
:search
|
||||
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
echo Unable to locate a Wrapper executable using any of the following names:
|
||||
echo %_WRAPPER_L_EXE%
|
||||
echo %_WRAPPER_EXE%
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
rem
|
||||
rem Find the wrapper.conf
|
||||
rem
|
||||
:conf
|
||||
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not [%_WRAPPER_CONF%]==[""] (
|
||||
shift
|
||||
goto :startup
|
||||
)
|
||||
)
|
||||
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||
|
||||
rem
|
||||
rem Start the Wrapper
|
||||
rem
|
||||
:startup
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
if not [%1]==[] (
|
||||
echo WARNING: Extra arguments will be ignored. Please check usage in the batch file.
|
||||
)
|
||||
)
|
||||
|
||||
rem Collect the application parameters
|
||||
:parameters
|
||||
set _PARAMETERS=%_PARAMETERS% %1
|
||||
shift
|
||||
if not [%1]==[] goto :parameters
|
||||
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
%_WRAPPER_EXE% -c %_WRAPPER_CONF%
|
||||
) else (
|
||||
%_WRAPPER_EXE% -c %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||
)
|
||||
if not errorlevel 1 goto :eof
|
||||
pause
|
||||
|
||||
|
@ -0,0 +1,135 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem
|
||||
rem Copyright (c) 1999, 2016 Tanuki Software, Ltd.
|
||||
rem http://www.tanukisoftware.com
|
||||
rem All rights reserved.
|
||||
rem
|
||||
rem This software is the proprietary information of Tanuki Software.
|
||||
rem You shall use it only in accordance with the terms of the
|
||||
rem license agreement you entered into with Tanuki Software.
|
||||
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||
rem
|
||||
rem Java Service Wrapper general startup script.
|
||||
rem
|
||||
|
||||
rem -----------------------------------------------------------------------------
|
||||
rem These settings can be modified to fit the needs of your application
|
||||
rem Optimized for use with version 3.5.28 of the Wrapper.
|
||||
|
||||
rem The base name for the Wrapper binary.
|
||||
set _WRAPPER_BASE=wrapper
|
||||
|
||||
rem The directory where the Wrapper binary (.exe) file is located. It can be
|
||||
rem either an absolute or a relative path. If the path contains any special
|
||||
rem characters, please make sure to quote the variable.
|
||||
set _WRAPPER_DIR=
|
||||
|
||||
rem The name and location of the Wrapper configuration file. This will be used
|
||||
rem if the user does not specify a configuration file as the first parameter to
|
||||
rem this script.
|
||||
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
|
||||
|
||||
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||
rem as the first parameter.
|
||||
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||
|
||||
rem Note that it is only possible to pass parameters through to the JVM when
|
||||
rem installing the service, or when running in a console.
|
||||
|
||||
rem Do not modify anything beyond this point
|
||||
rem -----------------------------------------------------------------------------
|
||||
|
||||
rem
|
||||
rem Resolve the real path of the wrapper.exe
|
||||
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||
rem can be hard-coded below and the following test removed.
|
||||
rem
|
||||
if "%OS%"=="Windows_NT" goto nt
|
||||
echo This script only works with NT-based versions of Windows.
|
||||
goto :eof
|
||||
|
||||
:nt
|
||||
rem Find the application home.
|
||||
rem if no path path specified do the default action
|
||||
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||
rem check if absolute path
|
||||
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||
rem everythig else means relative path
|
||||
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||
goto pathfound
|
||||
|
||||
:dir_undefined
|
||||
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||
set _REALPATH="%~dp0"
|
||||
goto pathfound
|
||||
:absolute_path
|
||||
rem Use an absolute path to the wrapper
|
||||
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||
|
||||
:pathfound
|
||||
rem
|
||||
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||
rem
|
||||
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||
goto search
|
||||
:amd64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||
goto search
|
||||
:ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||
goto search
|
||||
:search
|
||||
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
echo Unable to locate a Wrapper executable using any of the following names:
|
||||
echo %_WRAPPER_L_EXE%
|
||||
echo %_WRAPPER_EXE%
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
rem
|
||||
rem Find the wrapper.conf
|
||||
rem
|
||||
:conf
|
||||
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not [%_WRAPPER_CONF%]==[""] (
|
||||
shift
|
||||
goto :startup
|
||||
)
|
||||
)
|
||||
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||
|
||||
rem
|
||||
rem Start the Wrapper
|
||||
rem
|
||||
:startup
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
if not [%1]==[] (
|
||||
echo WARNING: Extra arguments will be ignored. Please check usage in the batch file.
|
||||
)
|
||||
)
|
||||
|
||||
rem Collect the application parameters
|
||||
:parameters
|
||||
set _PARAMETERS=%_PARAMETERS% %1
|
||||
shift
|
||||
if not [%1]==[] goto :parameters
|
||||
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
%_WRAPPER_EXE% -t %_WRAPPER_CONF%
|
||||
) else (
|
||||
%_WRAPPER_EXE% -t %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||
)
|
||||
if not errorlevel 1 goto :eof
|
||||
pause
|
@ -0,0 +1,135 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem
|
||||
rem Copyright (c) 1999, 2016 Tanuki Software, Ltd.
|
||||
rem http://www.tanukisoftware.com
|
||||
rem All rights reserved.
|
||||
rem
|
||||
rem This software is the proprietary information of Tanuki Software.
|
||||
rem You shall use it only in accordance with the terms of the
|
||||
rem license agreement you entered into with Tanuki Software.
|
||||
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||
rem
|
||||
rem Java Service Wrapper general startup script.
|
||||
rem
|
||||
|
||||
rem -----------------------------------------------------------------------------
|
||||
rem These settings can be modified to fit the needs of your application
|
||||
rem Optimized for use with version 3.5.28 of the Wrapper.
|
||||
|
||||
rem The base name for the Wrapper binary.
|
||||
set _WRAPPER_BASE=wrapper
|
||||
|
||||
rem The directory where the Wrapper binary (.exe) file is located. It can be
|
||||
rem either an absolute or a relative path. If the path contains any special
|
||||
rem characters, please make sure to quote the variable.
|
||||
set _WRAPPER_DIR=
|
||||
|
||||
rem The name and location of the Wrapper configuration file. This will be used
|
||||
rem if the user does not specify a configuration file as the first parameter to
|
||||
rem this script.
|
||||
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
|
||||
|
||||
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||
rem as the first parameter.
|
||||
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||
|
||||
rem Note that it is only possible to pass parameters through to the JVM when
|
||||
rem installing the service, or when running in a console.
|
||||
|
||||
rem Do not modify anything beyond this point
|
||||
rem -----------------------------------------------------------------------------
|
||||
|
||||
rem
|
||||
rem Resolve the real path of the wrapper.exe
|
||||
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||
rem can be hard-coded below and the following test removed.
|
||||
rem
|
||||
if "%OS%"=="Windows_NT" goto nt
|
||||
echo This script only works with NT-based versions of Windows.
|
||||
goto :eof
|
||||
|
||||
:nt
|
||||
rem Find the application home.
|
||||
rem if no path path specified do the default action
|
||||
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||
rem check if absolute path
|
||||
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||
rem everythig else means relative path
|
||||
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||
goto pathfound
|
||||
|
||||
:dir_undefined
|
||||
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||
set _REALPATH="%~dp0"
|
||||
goto pathfound
|
||||
:absolute_path
|
||||
rem Use an absolute path to the wrapper
|
||||
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||
|
||||
:pathfound
|
||||
rem
|
||||
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||
rem
|
||||
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||
goto search
|
||||
:amd64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||
goto search
|
||||
:ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||
goto search
|
||||
:search
|
||||
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
echo Unable to locate a Wrapper executable using any of the following names:
|
||||
echo %_WRAPPER_L_EXE%
|
||||
echo %_WRAPPER_EXE%
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
rem
|
||||
rem Find the wrapper.conf
|
||||
rem
|
||||
:conf
|
||||
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not [%_WRAPPER_CONF%]==[""] (
|
||||
shift
|
||||
goto :startup
|
||||
)
|
||||
)
|
||||
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||
|
||||
rem
|
||||
rem Start the Wrapper
|
||||
rem
|
||||
:startup
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
if not [%1]==[] (
|
||||
echo WARNING: Extra arguments will be ignored. Please check usage in the batch file.
|
||||
)
|
||||
)
|
||||
|
||||
rem Collect the application parameters
|
||||
:parameters
|
||||
set _PARAMETERS=%_PARAMETERS% %1
|
||||
shift
|
||||
if not [%1]==[] goto :parameters
|
||||
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
%_WRAPPER_EXE% -p %_WRAPPER_CONF%
|
||||
) else (
|
||||
%_WRAPPER_EXE% -p %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||
)
|
||||
if not errorlevel 1 goto :eof
|
||||
pause
|
@ -0,0 +1,135 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem
|
||||
rem Copyright (c) 1999, 2016 Tanuki Software, Ltd.
|
||||
rem http://www.tanukisoftware.com
|
||||
rem All rights reserved.
|
||||
rem
|
||||
rem This software is the proprietary information of Tanuki Software.
|
||||
rem You shall use it only in accordance with the terms of the
|
||||
rem license agreement you entered into with Tanuki Software.
|
||||
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||
rem
|
||||
rem Java Service Wrapper general startup script.
|
||||
rem
|
||||
|
||||
rem -----------------------------------------------------------------------------
|
||||
rem These settings can be modified to fit the needs of your application
|
||||
rem Optimized for use with version 3.5.28 of the Wrapper.
|
||||
|
||||
rem The base name for the Wrapper binary.
|
||||
set _WRAPPER_BASE=wrapper
|
||||
|
||||
rem The directory where the Wrapper binary (.exe) file is located. It can be
|
||||
rem either an absolute or a relative path. If the path contains any special
|
||||
rem characters, please make sure to quote the variable.
|
||||
set _WRAPPER_DIR=
|
||||
|
||||
rem The name and location of the Wrapper configuration file. This will be used
|
||||
rem if the user does not specify a configuration file as the first parameter to
|
||||
rem this script.
|
||||
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
|
||||
|
||||
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||
rem as the first parameter.
|
||||
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||
|
||||
rem Note that it is only possible to pass parameters through to the JVM when
|
||||
rem installing the service, or when running in a console.
|
||||
|
||||
rem Do not modify anything beyond this point
|
||||
rem -----------------------------------------------------------------------------
|
||||
|
||||
rem
|
||||
rem Resolve the real path of the wrapper.exe
|
||||
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||
rem can be hard-coded below and the following test removed.
|
||||
rem
|
||||
if "%OS%"=="Windows_NT" goto nt
|
||||
echo This script only works with NT-based versions of Windows.
|
||||
goto :eof
|
||||
|
||||
:nt
|
||||
rem Find the application home.
|
||||
rem if no path path specified do the default action
|
||||
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||
rem check if absolute path
|
||||
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||
rem everythig else means relative path
|
||||
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||
goto pathfound
|
||||
|
||||
:dir_undefined
|
||||
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||
set _REALPATH="%~dp0"
|
||||
goto pathfound
|
||||
:absolute_path
|
||||
rem Use an absolute path to the wrapper
|
||||
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||
|
||||
:pathfound
|
||||
rem
|
||||
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||
rem
|
||||
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||
goto search
|
||||
:amd64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||
goto search
|
||||
:ia64
|
||||
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||
goto search
|
||||
:search
|
||||
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||
if exist %_WRAPPER_EXE% goto conf
|
||||
echo Unable to locate a Wrapper executable using any of the following names:
|
||||
echo %_WRAPPER_L_EXE%
|
||||
echo %_WRAPPER_EXE%
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
rem
|
||||
rem Find the wrapper.conf
|
||||
rem
|
||||
:conf
|
||||
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not [%_WRAPPER_CONF%]==[""] (
|
||||
shift
|
||||
goto :startup
|
||||
)
|
||||
)
|
||||
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||
|
||||
rem
|
||||
rem Start the Wrapper
|
||||
rem
|
||||
:startup
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
if not [%1]==[] (
|
||||
echo WARNING: Extra arguments will be ignored. Please check usage in the batch file.
|
||||
)
|
||||
)
|
||||
|
||||
rem Collect the application parameters
|
||||
:parameters
|
||||
set _PARAMETERS=%_PARAMETERS% %1
|
||||
shift
|
||||
if not [%1]==[] goto :parameters
|
||||
|
||||
if not [%_PASS_THROUGH%]==[true] (
|
||||
%_WRAPPER_EXE% -r %_WRAPPER_CONF%
|
||||
) else (
|
||||
%_WRAPPER_EXE% -r %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||
)
|
||||
if not errorlevel 1 goto :eof
|
||||
pause
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,60 @@
|
||||
encoding=UTF-8
|
||||
wrapper.lang=zh_CN
|
||||
#using the system default JDK environment variable
|
||||
wrapper.java.command=java
|
||||
#set.JAVA_HOME=/home/jdk1.8.0_65
|
||||
#wrapper.java.command=%JAVA_HOME%/bin/java
|
||||
wrapper.java.command.loglevel=INFO
|
||||
|
||||
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
|
||||
wrapper.java.classpath.1=./
|
||||
wrapper.java.classpath.2=../conf/
|
||||
wrapper.java.classpath.3=../lib/*.jar
|
||||
|
||||
wrapper.java.library.path.1=../lib
|
||||
|
||||
wrapper.java.additional.auto_bits=TRUE
|
||||
#set the default parameters
|
||||
wrapper.java.additional.1=-Xms512m
|
||||
wrapper.java.additional.2=-Xmx1024m
|
||||
wrapper.java.additional.3=-XX:PermSize=256m
|
||||
wrapper.java.additional.4=-XX:MaxPermSize=512m
|
||||
wrapper.java.additional.5=-Djava.net.preferIPv4Stack=true
|
||||
wrapper.java.additional.6=-Dsun.lang.ClassLoader.allowArraySyntax=true
|
||||
|
||||
# Initial Java Heap Size (in MB)
|
||||
wrapper.java.initmemory=128
|
||||
# Maximum Java Heap Size (in MB)
|
||||
wrapper.java.maxmemory=512
|
||||
|
||||
# Application parameters. Add parameters as needed starting from 1
|
||||
wrapper.app.parameter.1=org.springframework.boot.loader.JarLauncher
|
||||
wrapper.app.parameter.2=--spring.config.location=../conf/application.properties
|
||||
wrapper.app.parameter.3=--logging.config=../conf/logback.xml
|
||||
wrapper.app.parameter.4=--logging.path=../logs
|
||||
|
||||
wrapper.filter.trigger.1=java.lang.OutOfMemoryError
|
||||
wrapper.filter.action.1=RESTART
|
||||
|
||||
wrapper.console.format=PM
|
||||
wrapper.console.loglevel=INFO
|
||||
|
||||
wrapper.logfile=../logs/mq_YYYYMMDD.log
|
||||
wrapper.logfile.rollmode=DATE
|
||||
wrapper.logfile.format=LPTM
|
||||
wrapper.logfile.loglevel=INFO
|
||||
wrapper.logfile.maxsize=0
|
||||
wrapper.logfile.maxfiles=0
|
||||
wrapper.syslog.loglevel=NONE
|
||||
|
||||
wrapper.ignore_sequence_gaps=TRUE
|
||||
wrapper.pidfile.strict=TRUE
|
||||
|
||||
wrapper.console.title=foodwaimai mq application
|
||||
|
||||
wrapper.name=foodwaimai_mq
|
||||
wrapper.displayname=foodwaimai mq application
|
||||
wrapper.description=foodwaimai mq application
|
||||
wrapper.ntservice.dependency.1=
|
||||
wrapper.ntservice.starttype=AUTO_START
|
||||
wrapper.ntservice.interactive=false
|
@ -0,0 +1,15 @@
|
||||
package com.jwsaas;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@ComponentScan(basePackages = "com.jwsaas")
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.jwsaas;
|
||||
|
||||
public class Constant {
|
||||
|
||||
/**
|
||||
* 系统默认数据源标识
|
||||
*/
|
||||
public static final String DEFAULT_DB_SIGN = "10001";
|
||||
|
||||
/**
|
||||
* 系统默认创建人
|
||||
*/
|
||||
public static final String CREATE_USER = "OpenApi";
|
||||
|
||||
/**
|
||||
* 系统默认redis前缀
|
||||
*/
|
||||
public static final String DEFAULT_REDIS_PREFIX = "food20OpenApi";
|
||||
|
||||
/**
|
||||
* 公共部分标识(shared)
|
||||
*/
|
||||
public static final String SHARED_SIGN = "shared";
|
||||
|
||||
/**
|
||||
* 餐饮项目标识(food2)
|
||||
*/
|
||||
public static final String FOOD_SIGN = "food2";
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.jwsaas;
|
||||
|
||||
public class RabbitConstant {
|
||||
|
||||
public final static String EXCHANGE_NAME = "exchange";// 交换器
|
||||
|
||||
/**
|
||||
* 饿了么相关
|
||||
*/
|
||||
public final static String QUEUE_NAME_ELEME_CREATE = "queue4elemecreate";// 饿了么新订单
|
||||
|
||||
public final static String QUEUE_NAME_ELEME_UPDATE = "queue4elemeupdate";// 饿了么更新订单
|
||||
|
||||
/**
|
||||
* 美团相关
|
||||
*/
|
||||
public final static String QUEUE_NAME_MEITUAN_CREATE = "queue4meituancreate";// 美团新订单
|
||||
|
||||
public final static String QUEUE_NAME_MEITUAN_UPDATE = "queue4meituanupdate";// 美团更新订单
|
||||
|
||||
|
||||
/**
|
||||
* 企迈相关
|
||||
*/
|
||||
public final static String QUEUE_NAME_QIMAI_CREATE = "queue4qimaicreate";// 企迈新订单
|
||||
|
||||
public final static String QUEUE_NAME_QIMAI_UPDATE = "queue4qimaiupdate";// 企迈更新订单
|
||||
|
||||
/**
|
||||
* 提点相关
|
||||
*/
|
||||
public final static String QUEUE_NAME_TIDIAN_CREATE = "queue4tidiancreate";// 提点新订单
|
||||
|
||||
public final static String QUEUE_NAME_TIDIAN_UPDATE = "queue4tidianupdate";// 提点更新订单
|
||||
|
||||
|
||||
/**
|
||||
* 商家美团相关
|
||||
*/
|
||||
public final static String QUEUE_NAME_SHOPMEITUAN_CREATE = "queue4shopmeituancreate";// 商家美团新订单
|
||||
|
||||
public final static String QUEUE_NAME_SHOPMEITUAN_UPDATE = "queue4shopmeituanupdate";// 商家美团更新订单
|
||||
|
||||
|
||||
public static final String QUEUE_NAME_WAIMAI_ORDER_DELAY = "queue4waimaimorderdelay";//外卖订单推送延时队列
|
||||
public static final String ROUTING_KEY_WAIMAI_ORDER_NOTIFY = "routing4waimaiordernotify";//外卖订单推送;
|
||||
public static final String ROUTING_KEY_WAIMAI_ORDER_NOTIFY_DELAY = "routing4waimaiordernotifydelay";//外卖订单延时推送
|
||||
public static final String QUEUE_NAME_WAIMAI_ORDER_NOTIFY = "queue4waimaiordernotify";//外卖订单推送队列
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.jwsaas.config;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import com.jwsaas.cache.CacheService;
|
||||
import com.jwsaas.service.food.ElemeOrderDetailService;
|
||||
import com.jwsaas.service.food.MeituanOrderService;
|
||||
import com.jwsaas.service.food.QimaiOrderService;
|
||||
import com.jwsaas.service.food.ShopMeituanOrderService;
|
||||
|
||||
@Component
|
||||
public class DubboSupport {
|
||||
|
||||
@Reference(group = "${food.service.group}", version = "${food.service.version}", application = "${dubbo.application.id}", consumer = "${dubbo.consumer.id}", registry = "${dubbo.registry.id}")
|
||||
private CacheService cacheService;
|
||||
|
||||
@Reference(group = "${food.service.group}", version = "${food.service.version}", application = "${dubbo.application.id}", consumer = "${dubbo.consumer.id}", registry = "${dubbo.registry.id}")
|
||||
private ElemeOrderDetailService elemeOrderDetailService;
|
||||
|
||||
@Reference(group = "${food.service.group}", version = "${food.service.version}", application = "${dubbo.application.id}", consumer = "${dubbo.consumer.id}", registry = "${dubbo.registry.id}")
|
||||
private MeituanOrderService meituanOrderService;
|
||||
|
||||
@Reference(group = "${food.service.group}", version = "${food.service.version}", application = "${dubbo.application.id}", consumer = "${dubbo.consumer.id}", registry = "${dubbo.registry.id}")
|
||||
private QimaiOrderService qimaiOrderService;
|
||||
|
||||
@Reference(group = "${food.service.group}", version = "${food.service.version}", application = "${dubbo.application.id}", consumer = "${dubbo.consumer.id}", registry = "${dubbo.registry.id}")
|
||||
private ShopMeituanOrderService shopMeituanOrderService;
|
||||
|
||||
|
||||
public CacheService getCacheService() {
|
||||
return cacheService;
|
||||
}
|
||||
|
||||
public ElemeOrderDetailService getElemeOrderDetailService() {
|
||||
return elemeOrderDetailService;
|
||||
}
|
||||
|
||||
public MeituanOrderService getMeituanOrderService() {
|
||||
return meituanOrderService;
|
||||
}
|
||||
|
||||
public QimaiOrderService getQimaiOrderService() {
|
||||
return qimaiOrderService;
|
||||
}
|
||||
|
||||
public ShopMeituanOrderService getShopMeituanOrderService() {
|
||||
return shopMeituanOrderService;
|
||||
}
|
||||
|
||||
public void setShopMeituanOrderService(ShopMeituanOrderService shopMeituanOrderService) {
|
||||
this.shopMeituanOrderService = shopMeituanOrderService;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.jwsaas.config;
|
||||
|
||||
import org.springframework.amqp.AmqpException;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.core.MessagePostProcessor;
|
||||
|
||||
/**
|
||||
* 延时队列使用
|
||||
* @author yangaming
|
||||
*
|
||||
*/
|
||||
public class ExpirationMessagePostProcessor implements MessagePostProcessor {
|
||||
|
||||
private final Long ttl;//毫秒
|
||||
|
||||
public ExpirationMessagePostProcessor(Long ttl) {
|
||||
this.ttl = ttl;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Message postProcessMessage(Message message) throws AmqpException {
|
||||
message.getMessageProperties().setExpiration(ttl.toString());
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,747 @@
|
||||
package com.jwsaas.config;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.jwsaas.cache.CacheService;
|
||||
import com.jwsaas.mqtt.MqttClientExt;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
|
||||
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
||||
import org.springframework.amqp.rabbit.support.CorrelationData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.jwsaas.RabbitConstant;
|
||||
import com.jwsaas.entity.food.ElemeOrderDetail;
|
||||
import com.jwsaas.entity.food.ElemeOrderDetailGroup;
|
||||
import com.jwsaas.entity.food.MeituanOrder;
|
||||
import com.jwsaas.entity.food.MeituanOrderExtra;
|
||||
import com.jwsaas.entity.food.MeituanOrderItem;
|
||||
import com.jwsaas.entity.food.QimaiOrder;
|
||||
import com.jwsaas.entity.food.QimaiOrderItem;
|
||||
import com.jwsaas.entity.food.QimaiOrderPay;
|
||||
import com.jwsaas.entity.food.ShopMeituanOrder;
|
||||
import com.jwsaas.entity.food.ShopMeituanOrderExtra;
|
||||
import com.jwsaas.entity.food.ShopMeituanOrderItem;
|
||||
import com.jwsaas.service.food.ElemeOrderDetailService;
|
||||
import com.jwsaas.service.food.MeituanOrderService;
|
||||
import com.jwsaas.service.food.QimaiOrderService;
|
||||
import com.jwsaas.service.food.ShopMeituanOrderService;
|
||||
import com.jwsaas.util.JSONUtil;
|
||||
import com.rabbitmq.client.Channel;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Configuration
|
||||
public class RabbitMQConfig {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Value("${spring.rabbitmq.host}")
|
||||
private String host;
|
||||
|
||||
@Value("${spring.rabbitmq.port}")
|
||||
private String port;
|
||||
|
||||
@Value("${spring.rabbitmq.username}")
|
||||
private String username;
|
||||
|
||||
@Value("${spring.rabbitmq.password}")
|
||||
private String password;
|
||||
|
||||
@Value("${spring.rabbitmq.publisherConfirms}")
|
||||
private Boolean publisherConfirms;
|
||||
|
||||
@Value("${spring.rabbitmq.virtualHost}")
|
||||
private String virtualHost;
|
||||
|
||||
@Autowired
|
||||
private DubboSupport dubboSupport;
|
||||
|
||||
@Autowired
|
||||
private MQMessageSender mqMessageSender;
|
||||
|
||||
@Resource
|
||||
private MqttClientExt mqttClient;
|
||||
|
||||
|
||||
private DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 创建工厂连接
|
||||
@Bean
|
||||
public ConnectionFactory connectionFactory() {
|
||||
CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
|
||||
connectionFactory.setAddresses(this.host);
|
||||
connectionFactory.setUsername(this.username);
|
||||
connectionFactory.setPassword(this.password);
|
||||
connectionFactory.setVirtualHost(this.virtualHost);
|
||||
connectionFactory.setPublisherConfirms(this.publisherConfirms); // 必须要设置
|
||||
connectionFactory.setChannelCacheSize(100);
|
||||
return connectionFactory;
|
||||
}
|
||||
|
||||
// 直连交换机
|
||||
@Bean
|
||||
public DirectExchange defaultExchange() {
|
||||
return new DirectExchange(RabbitConstant.EXCHANGE_NAME);
|
||||
}
|
||||
|
||||
// 队列-饿了么订单创建
|
||||
@Bean(name = "queue4elemecreate")
|
||||
public Queue queue4elemecreate() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_ELEME_CREATE).build();
|
||||
}
|
||||
|
||||
@Bean(name = "messageContainer4elemecreate")
|
||||
public SimpleMessageListenerContainer messageContainer4elemecreate() {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory());
|
||||
// container.setTaskExecutor(taskExecutor);
|
||||
container.setQueues(this.queue4elemecreate()); // 设置要监听的队列
|
||||
container.setExposeListenerChannel(true);
|
||||
container.setMaxConcurrentConsumers(10);
|
||||
container.setConcurrentConsumers(5);
|
||||
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置确认模式手工确认
|
||||
container.setMessageListener(new ChannelAwareMessageListener() {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
try {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.debug("receive msg : " + bodyContent);
|
||||
Map<String, Object> dataMap = JSONUtil.parseObject(bodyContent, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
logger.debug("dataMap: " + JSONUtil.toJSONString(dataMap));
|
||||
|
||||
String tenantId = dataMap.get("tenantId").toString();
|
||||
String type = dataMap.get("type").toString();
|
||||
ElemeOrderDetail newEntity = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("newEntity")), new TypeReference<ElemeOrderDetail>() {
|
||||
});
|
||||
newEntity.setDescription(filter(newEntity.getDescription()));
|
||||
List<ElemeOrderDetailGroup> groupList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("groupList")), new TypeReference<List<ElemeOrderDetailGroup>>() {
|
||||
});
|
||||
for (ElemeOrderDetailGroup elemeOrderDetailGroup : groupList) {
|
||||
elemeOrderDetailGroup.setGroupName(filter(elemeOrderDetailGroup.getGroupName()));
|
||||
}
|
||||
logger.debug("tenantId:" + tenantId);
|
||||
logger.debug("type:" + type);
|
||||
logger.debug("newEntity:" + newEntity);
|
||||
logger.debug("groupList:" + groupList);
|
||||
|
||||
Date currentDate = new Date();
|
||||
ElemeOrderDetailService elemeOrderDetailService = dubboSupport.getElemeOrderDetailService();
|
||||
// 保存上传数据
|
||||
elemeOrderDetailService.saveDetail(tenantId, newEntity, groupList);
|
||||
logger.info("MQ消息(饿了么外卖订单上传)处理完成--->[{},{},{}]", tenantId, type, currentDate);
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.info("receive msg : " + bodyContent);
|
||||
logger.error("MQ消息(饿了么外卖订单上传)处理发生异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
// 队列-饿了么订单修改
|
||||
@Bean(name = "queue4elemeupdate")
|
||||
public Queue queue4elemeupdate() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_ELEME_UPDATE).build();
|
||||
}
|
||||
|
||||
@Bean(name = "messageContainer4elemeupdate")
|
||||
public SimpleMessageListenerContainer messageContainer4elemeupdate() {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory());
|
||||
// container.setTaskExecutor(taskExecutor);
|
||||
container.setQueues(this.queue4elemeupdate()); // 设置要监听的队列
|
||||
container.setExposeListenerChannel(true);
|
||||
container.setMaxConcurrentConsumers(10);
|
||||
container.setConcurrentConsumers(5);
|
||||
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置确认模式手工确认
|
||||
container.setMessageListener(new ChannelAwareMessageListener() {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
try {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.debug("receive msg : " + bodyContent);
|
||||
Map<String, Object> dataMap = JSONUtil.parseObject(bodyContent, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
logger.debug("dataMap: " + JSONUtil.toJSONString(dataMap));
|
||||
|
||||
String tenantId = dataMap.get("tenantId").toString();
|
||||
String type = dataMap.get("type").toString();
|
||||
ElemeOrderDetail newEntity = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("newEntity")), new TypeReference<ElemeOrderDetail>() {
|
||||
});
|
||||
newEntity.setDescription(filter(newEntity.getDescription()));
|
||||
List<ElemeOrderDetailGroup> groupList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("groupList")), new TypeReference<List<ElemeOrderDetailGroup>>() {
|
||||
});
|
||||
for (ElemeOrderDetailGroup elemeOrderDetailGroup : groupList) {
|
||||
elemeOrderDetailGroup.setGroupName(filter(elemeOrderDetailGroup.getGroupName()));
|
||||
}
|
||||
logger.debug("tenantId:" + tenantId);
|
||||
logger.debug("type:" + type);
|
||||
logger.debug("newEntity:" + newEntity);
|
||||
logger.debug("groupList:" + groupList);
|
||||
|
||||
Date currentDate = new Date();
|
||||
ElemeOrderDetailService elemeOrderDetailService = dubboSupport.getElemeOrderDetailService();
|
||||
// 保存上传数据
|
||||
elemeOrderDetailService.updateDetail(tenantId, newEntity, groupList);
|
||||
logger.info("MQ消息(饿了么外卖订单更新)处理完成--->[{},{},{}]", tenantId, type, currentDate);
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.info("receive msg : " + bodyContent);
|
||||
logger.error("MQ消息(饿了么外卖订单更新)处理发生异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
// 队列-美团订单创建
|
||||
@Bean(name = "queue4meituancreate")
|
||||
public Queue queue4meituancreate() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_MEITUAN_CREATE).build();
|
||||
}
|
||||
|
||||
@Bean(name = "messageContainer4meituancreate")
|
||||
public SimpleMessageListenerContainer messageContainer4meituancreate() {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory());
|
||||
// container.setTaskExecutor(taskExecutor);
|
||||
container.setQueues(this.queue4meituancreate()); // 设置要监听的队列
|
||||
container.setExposeListenerChannel(true);
|
||||
container.setMaxConcurrentConsumers(10);
|
||||
container.setConcurrentConsumers(5);
|
||||
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置确认模式手工确认
|
||||
container.setMessageListener(new ChannelAwareMessageListener() {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
try {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.debug("receive msg : " + bodyContent);
|
||||
Map<String, Object> dataMap = JSONUtil.parseObject(bodyContent, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
logger.debug("dataMap: " + JSONUtil.toJSONString(dataMap));
|
||||
|
||||
String tenantId = dataMap.get("tenantId").toString();
|
||||
String type = dataMap.get("type").toString();
|
||||
MeituanOrder newEntity = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("newEntity")), new TypeReference<MeituanOrder>() {
|
||||
});
|
||||
newEntity.setCaution(filter(newEntity.getCaution()));
|
||||
newEntity.setRecipientName(filter(newEntity.getRecipientName()));
|
||||
newEntity.setDetail(filter(newEntity.getDetail()));
|
||||
newEntity.setExtras(filter(newEntity.getExtras()));
|
||||
newEntity.setPoiReceiveDetail(filter(newEntity.getPoiReceiveDetail()));
|
||||
newEntity.setRecipientAddress(filter(newEntity.getRecipientAddress()));
|
||||
List<MeituanOrderItem> itemList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("itemList")), new TypeReference<List<MeituanOrderItem>>() {
|
||||
});
|
||||
for (MeituanOrderItem meituanOrderItem : itemList) {
|
||||
if (filter(meituanOrderItem.getEDishCode()).length() > 32) {
|
||||
meituanOrderItem.setEDishCode(filter(meituanOrderItem.getEDishCode()).substring(0, 32));
|
||||
} else {
|
||||
meituanOrderItem.setEDishCode(filter(meituanOrderItem.getEDishCode()));
|
||||
}
|
||||
meituanOrderItem.setDishName(filter(meituanOrderItem.getDishName()));
|
||||
}
|
||||
List<MeituanOrderExtra> extraList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("extraList")), new TypeReference<List<MeituanOrderExtra>>() {
|
||||
});
|
||||
for (MeituanOrderExtra meituanOrderExtra : extraList) {
|
||||
meituanOrderExtra.setRemark(filter(meituanOrderExtra.getRemark()));
|
||||
}
|
||||
logger.debug("tenantId:" + tenantId);
|
||||
logger.debug("type:" + type);
|
||||
logger.debug("newEntity:" + newEntity);
|
||||
logger.debug("itemList:" + itemList);
|
||||
logger.debug("extraList:" + extraList);
|
||||
Date currentDate = new Date();
|
||||
MeituanOrderService meituanOrderService = dubboSupport.getMeituanOrderService();
|
||||
// 保存上传数据
|
||||
meituanOrderService.saveOrder(tenantId, newEntity, itemList, extraList);
|
||||
logger.info("MQ消息(美团外卖订单上传)处理完成--->[{},{},{}]", tenantId, type, currentDate);
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.info("receive msg : " + bodyContent);
|
||||
logger.error("MQ消息(美团外卖订单上传)处理发生异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
// 队列-美团订单修改
|
||||
@Bean(name = "queue4meituanupdate")
|
||||
public Queue queue4meituanupdate() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_MEITUAN_UPDATE).build();
|
||||
}
|
||||
|
||||
@Bean(name = "messageContainer4meituanupdate")
|
||||
public SimpleMessageListenerContainer messageContainer4meituanupdate() {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory());
|
||||
// container.setTaskExecutor(taskExecutor);
|
||||
container.setQueues(this.queue4meituanupdate()); // 设置要监听的队列
|
||||
container.setExposeListenerChannel(true);
|
||||
container.setMaxConcurrentConsumers(10);
|
||||
container.setConcurrentConsumers(5);
|
||||
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置确认模式手工确认
|
||||
container.setMessageListener(new ChannelAwareMessageListener() {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
try {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.debug("receive msg : " + bodyContent);
|
||||
Map<String, Object> dataMap = JSONUtil.parseObject(bodyContent, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
logger.debug("dataMap: " + JSONUtil.toJSONString(dataMap));
|
||||
|
||||
String tenantId = dataMap.get("tenantId").toString();
|
||||
String type = dataMap.get("type").toString();
|
||||
MeituanOrder newEntity = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("newEntity")), new TypeReference<MeituanOrder>() {
|
||||
});
|
||||
newEntity.setCaution(filter(newEntity.getCaution()));
|
||||
newEntity.setRecipientName(filter(newEntity.getRecipientName()));
|
||||
newEntity.setDetail(filter(newEntity.getDetail()));
|
||||
newEntity.setExtras(filter(newEntity.getExtras()));
|
||||
newEntity.setPoiReceiveDetail(filter(newEntity.getPoiReceiveDetail()));
|
||||
newEntity.setRecipientAddress(filter(newEntity.getRecipientAddress()));
|
||||
logger.debug("tenantId:" + tenantId);
|
||||
logger.debug("type:" + type);
|
||||
logger.debug("newEntity:" + newEntity);
|
||||
|
||||
Date currentDate = new Date();
|
||||
MeituanOrderService meituanOrderService = dubboSupport.getMeituanOrderService();
|
||||
// 保存上传数据
|
||||
meituanOrderService.update(tenantId, newEntity);
|
||||
logger.info("MQ消息(美团外卖订单更新)处理完成--->[{},{},{}]", tenantId, type, currentDate);
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.info("receive msg : " + bodyContent);
|
||||
logger.error("MQ消息(美团外卖订单更新)处理发生异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
// 队列-企迈订单创建
|
||||
@Bean(name = "queue4qimaicreate")
|
||||
public Queue queue4qimaicreate() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_QIMAI_CREATE).build();
|
||||
}
|
||||
|
||||
@Bean(name = "messageContainer4qimaicreate")
|
||||
public SimpleMessageListenerContainer messageContainer4qimaicreate() {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory());
|
||||
// container.setTaskExecutor(taskExecutor);
|
||||
container.setQueues(this.queue4qimaicreate()); // 设置要监听的队列
|
||||
container.setExposeListenerChannel(true);
|
||||
container.setMaxConcurrentConsumers(10);
|
||||
container.setConcurrentConsumers(5);
|
||||
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置确认模式手工确认
|
||||
container.setMessageListener(new ChannelAwareMessageListener() {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
try {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.debug("receive msg : " + bodyContent);
|
||||
Map<String, Object> dataMap = JSONUtil.parseObject(bodyContent, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
logger.debug("dataMap: " + JSONUtil.toJSONString(dataMap));
|
||||
|
||||
String tenantId = dataMap.get("tenantId").toString();
|
||||
String type = dataMap.get("type").toString();
|
||||
QimaiOrder newEntity = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("newEntity")), new TypeReference<QimaiOrder>() {
|
||||
});
|
||||
newEntity.setUserName(filter(newEntity.getUserName()));
|
||||
newEntity.setPayUserName(filter(newEntity.getPayUserName()));
|
||||
newEntity.setGoods(filter(newEntity.getGoods()));
|
||||
newEntity.setUserNameAll(filter(newEntity.getUserNameAll()));
|
||||
List<QimaiOrderItem> itemList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("itemList")), new TypeReference<List<QimaiOrderItem>>() {
|
||||
});
|
||||
List<QimaiOrderPay> payList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("payList")), new TypeReference<List<QimaiOrderPay>>() {
|
||||
});
|
||||
logger.debug("tenantId:" + tenantId);
|
||||
logger.debug("type:" + type);
|
||||
logger.debug("newEntity:" + newEntity);
|
||||
logger.debug("itemList:" + itemList);
|
||||
logger.debug("payList:" + payList);
|
||||
|
||||
Date currentDate = new Date();
|
||||
QimaiOrderService qimaiOrderService = dubboSupport.getQimaiOrderService();
|
||||
// 保存上传数据
|
||||
qimaiOrderService.saveOrder(tenantId, newEntity, itemList, payList);
|
||||
logger.info("MQ消息(企迈外卖订单上传)处理完成--->[{},{},{}]", tenantId, type, currentDate);
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.info("receive msg : " + bodyContent);
|
||||
logger.error("MQ消息(企迈外卖订单上传)处理发生异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
// 队列-企迈订单修改
|
||||
@Bean(name = "queue4qimaiupdate")
|
||||
public Queue queue4qimaiupdate() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_QIMAI_UPDATE).build();
|
||||
}
|
||||
|
||||
@Bean(name = "messageContainer4qimaiupdate")
|
||||
public SimpleMessageListenerContainer messageContainer4qimaiupdate() {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory());
|
||||
// container.setTaskExecutor(taskExecutor);
|
||||
container.setQueues(this.queue4qimaiupdate()); // 设置要监听的队列
|
||||
container.setExposeListenerChannel(true);
|
||||
container.setMaxConcurrentConsumers(10);
|
||||
container.setConcurrentConsumers(5);
|
||||
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置确认模式手工确认
|
||||
container.setMessageListener(new ChannelAwareMessageListener() {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
try {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.debug("receive msg : " + bodyContent);
|
||||
Map<String, Object> dataMap = JSONUtil.parseObject(bodyContent, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
logger.debug("dataMap: " + JSONUtil.toJSONString(dataMap));
|
||||
|
||||
String tenantId = dataMap.get("tenantId").toString();
|
||||
String type = dataMap.get("type").toString();
|
||||
QimaiOrder newEntity = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("newEntity")), new TypeReference<QimaiOrder>() {
|
||||
});
|
||||
newEntity.setUserName(filter(newEntity.getUserName()));
|
||||
newEntity.setPayUserName(filter(newEntity.getPayUserName()));
|
||||
newEntity.setGoods(filter(newEntity.getGoods()));
|
||||
newEntity.setUserNameAll(filter(newEntity.getUserNameAll()));
|
||||
List<QimaiOrderItem> itemList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("itemList")), new TypeReference<List<QimaiOrderItem>>() {
|
||||
});
|
||||
List<QimaiOrderPay> payList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("payList")), new TypeReference<List<QimaiOrderPay>>() {
|
||||
});
|
||||
logger.debug("tenantId:" + tenantId);
|
||||
logger.debug("type:" + type);
|
||||
logger.debug("newEntity:" + newEntity);
|
||||
logger.debug("itemList:" + itemList);
|
||||
logger.debug("payList:" + payList);
|
||||
|
||||
Date currentDate = new Date();
|
||||
QimaiOrderService qimaiOrderService = dubboSupport.getQimaiOrderService();
|
||||
// 保存上传数据
|
||||
qimaiOrderService.updateOrder(tenantId, newEntity, itemList, payList);
|
||||
logger.info("MQ消息(企迈订单更新)处理完成--->[{},{},{}]", tenantId, type, currentDate);
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.info("receive msg : " + bodyContent);
|
||||
logger.error("MQ消息(企迈订单更新)处理发生异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
public static String filter(String str) {
|
||||
if (str.trim().isEmpty()) {
|
||||
return str;
|
||||
}
|
||||
String pattern = "[\uD83C\uDC04-\uD83C\uDE1A]|[\uD83D\uDC66-\uD83D\uDC69]|[\uD83D\uDC66\uD83C\uDFFB-\uD83D\uDC69\uD83C\uDFFF]|[\uD83D\uDE45\uD83C\uDFFB-\uD83D\uDE4F\uD83C\uDFFF]|[\uD83C\uDC00-\uD83D\uDFFF]|[\uD83E\uDD10-\uD83E\uDDC0]|[\uD83D\uDE00-\uD83D\uDE4F]|[\uD83D\uDE80-\uD83D\uDEF6]|[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]";
|
||||
String reStr = "";
|
||||
Pattern emoji = Pattern.compile(pattern);
|
||||
Matcher emojiMatcher = emoji.matcher(str);
|
||||
str = emojiMatcher.replaceAll(reStr);
|
||||
return str.replace("\\", "");
|
||||
}
|
||||
|
||||
// 队列-商家美团订单创建
|
||||
@Bean(name = "queue4shopmeituancreate")
|
||||
public Queue queue4shopmeituancreate() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_SHOPMEITUAN_CREATE).build();
|
||||
}
|
||||
|
||||
@Bean(name = "messageContainer4shopmeituancreate")
|
||||
public SimpleMessageListenerContainer messageContainer4shopmeituancreate() {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory());
|
||||
// container.setTaskExecutor(taskExecutor);
|
||||
container.setQueues(this.queue4shopmeituancreate()); // 设置要监听的队列
|
||||
container.setExposeListenerChannel(true);
|
||||
container.setMaxConcurrentConsumers(10);
|
||||
container.setConcurrentConsumers(5);
|
||||
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置确认模式手工确认
|
||||
container.setMessageListener(new ChannelAwareMessageListener() {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
try {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.debug("receive msg : " + bodyContent);
|
||||
Map<String, Object> dataMap = JSONUtil.parseObject(bodyContent, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
logger.debug("dataMap: " + JSONUtil.toJSONString(dataMap));
|
||||
|
||||
String tenantId = dataMap.get("tenantId").toString();
|
||||
String type = dataMap.get("type").toString();
|
||||
ShopMeituanOrder newEntity = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("newEntity")), new TypeReference<ShopMeituanOrder>() {
|
||||
});
|
||||
newEntity.setCaution(filter(newEntity.getCaution()));
|
||||
newEntity.setRecipientName(filter(newEntity.getRecipientName()));
|
||||
newEntity.setDetail(filter(newEntity.getDetail()));
|
||||
newEntity.setExtras(filter(newEntity.getExtras()));
|
||||
newEntity.setPoiReceiveDetail(filter(newEntity.getPoiReceiveDetail()));
|
||||
newEntity.setRecipientAddress(filter(newEntity.getRecipientAddress()));
|
||||
List<ShopMeituanOrderItem> itemList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("itemList")), new TypeReference<List<ShopMeituanOrderItem>>() {
|
||||
});
|
||||
for (ShopMeituanOrderItem meituanOrderItem : itemList) {
|
||||
if (filter(meituanOrderItem.getAppFoodCode()).length() > 32) {
|
||||
meituanOrderItem.setAppFoodCode(filter(meituanOrderItem.getAppFoodCode()).substring(0, 32));
|
||||
} else {
|
||||
meituanOrderItem.setAppFoodCode(filter(meituanOrderItem.getAppFoodCode()));
|
||||
}
|
||||
meituanOrderItem.setFoodName(filter(meituanOrderItem.getFoodName()));
|
||||
}
|
||||
List<ShopMeituanOrderExtra> extraList = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("extraList")), new TypeReference<List<ShopMeituanOrderExtra>>() {
|
||||
});
|
||||
for (ShopMeituanOrderExtra meituanOrderExtra : extraList) {
|
||||
meituanOrderExtra.setRemark(filter(meituanOrderExtra.getRemark()));
|
||||
}
|
||||
logger.debug("tenantId:" + tenantId);
|
||||
logger.debug("type:" + type);
|
||||
logger.debug("newEntity:" + newEntity);
|
||||
logger.debug("itemList:" + itemList);
|
||||
logger.debug("extraList:" + extraList);
|
||||
Date currentDate = new Date();
|
||||
ShopMeituanOrderService meituanOrderService = dubboSupport.getShopMeituanOrderService();
|
||||
// 保存上传数据
|
||||
meituanOrderService.saveOrder(tenantId, newEntity, itemList, extraList);
|
||||
logger.info("MQ消息(商家美团外卖订单上传)处理完成--->[{},{},{}]", tenantId, type, currentDate);
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.info("receive msg : " + bodyContent);
|
||||
logger.error("MQ消息(商家美团外卖订单上传)处理发生异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
// 队列-美团订单修改
|
||||
@Bean(name = "queue4shopmeituanupdate")
|
||||
public Queue queue4shopmeituanupdate() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_SHOPMEITUAN_UPDATE).build();
|
||||
}
|
||||
|
||||
@Bean(name = "messageContainer4shopmeituanupdate")
|
||||
public SimpleMessageListenerContainer messageContainer4shopmeituanupdate() {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory());
|
||||
// container.setTaskExecutor(taskExecutor);
|
||||
container.setQueues(this.queue4shopmeituanupdate()); // 设置要监听的队列
|
||||
container.setExposeListenerChannel(true);
|
||||
container.setMaxConcurrentConsumers(10);
|
||||
container.setConcurrentConsumers(5);
|
||||
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置确认模式手工确认
|
||||
container.setMessageListener(new ChannelAwareMessageListener() {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
try {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.debug("receive msg : " + bodyContent);
|
||||
Map<String, Object> dataMap = JSONUtil.parseObject(bodyContent, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
logger.debug("dataMap: " + JSONUtil.toJSONString(dataMap));
|
||||
|
||||
String tenantId = dataMap.get("tenantId").toString();
|
||||
String type = dataMap.get("type").toString();
|
||||
ShopMeituanOrder newEntity = JSONUtil.parseObject(JSONUtil.toJSONString(dataMap.get("newEntity")), new TypeReference<ShopMeituanOrder>() {
|
||||
});
|
||||
newEntity.setCaution(filter(newEntity.getCaution()));
|
||||
newEntity.setRecipientName(filter(newEntity.getRecipientName()));
|
||||
newEntity.setDetail(filter(newEntity.getDetail()));
|
||||
newEntity.setExtras(filter(newEntity.getExtras()));
|
||||
newEntity.setPoiReceiveDetail(filter(newEntity.getPoiReceiveDetail()));
|
||||
newEntity.setRecipientAddress(filter(newEntity.getRecipientAddress()));
|
||||
logger.debug("tenantId:" + tenantId);
|
||||
logger.debug("type:" + type);
|
||||
logger.debug("newEntity:" + newEntity);
|
||||
|
||||
Date currentDate = new Date();
|
||||
ShopMeituanOrderService meituanOrderService = dubboSupport.getShopMeituanOrderService();
|
||||
// 保存上传数据
|
||||
meituanOrderService.update(tenantId, newEntity);
|
||||
logger.info("MQ消息(商家美团外卖订单更新)处理完成--->[{},{},{}]", tenantId, type, currentDate);
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.info("receive msg : " + bodyContent);
|
||||
logger.error("MQ消息(商家美团外卖订单更新)处理发生异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 延迟队列
|
||||
*/
|
||||
@Bean(name = "queue4waimaiorder4delay")
|
||||
public Queue queue4waimaiorder4delay() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_WAIMAI_ORDER_DELAY)
|
||||
.withArgument("x-dead-letter-exchange", RabbitConstant.EXCHANGE_NAME)
|
||||
.withArgument("x-dead-letter-routing-key", RabbitConstant.ROUTING_KEY_WAIMAI_ORDER_NOTIFY)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean(name = "binding4waimaiorder4delay")
|
||||
public Binding binding4waimaiorder4delay() {
|
||||
return BindingBuilder.bind(this.queue4waimaiorder4delay()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_WAIMAI_ORDER_NOTIFY_DELAY);
|
||||
}
|
||||
|
||||
|
||||
// 队列-外卖订单信息推送
|
||||
@Bean(name = "queue4waimaiordernotify")
|
||||
public Queue queue4waimaiordernotify() {
|
||||
return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_WAIMAI_ORDER_NOTIFY).build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Bean(name = "messageContainer4waimaiordernotify")
|
||||
public SimpleMessageListenerContainer messageContainer4waimaiordernotify() {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory());
|
||||
container.setQueues(this.queue4waimaiordernotify()); // 设置要监听的队列
|
||||
container.setExposeListenerChannel(true);
|
||||
container.setMaxConcurrentConsumers(10);
|
||||
container.setConcurrentConsumers(5);
|
||||
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置确认模式手工确认
|
||||
container.setMessageListener(new ChannelAwareMessageListener(){
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
try{
|
||||
byte[] body = message.getBody();
|
||||
String bodyContent = new String(body);
|
||||
logger.error("receive msg : " + bodyContent);
|
||||
Map<String, Object> dataMap = JSONUtil.parseObject(bodyContent, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
logger.debug("dataMap: " + JSONUtil.toJSONString(dataMap));
|
||||
|
||||
CacheService cacheService = dubboSupport.getCacheService();
|
||||
|
||||
String tenantId = dataMap.get("tenantId").toString();
|
||||
String storeId = dataMap.get("storeId").toString();
|
||||
String waimaiType = dataMap.get("waimaiType").toString();
|
||||
String orderType = dataMap.get("orderType").toString();
|
||||
String orderId = dataMap.get("orderId").toString();
|
||||
String cancelOrder = dataMap.get("cancelOrder") == null ? null : dataMap.get("cancelOrder").toString();
|
||||
|
||||
Integer reSendNums = dataMap.get("reSendNums") == null ? 0:(Integer)dataMap.get("reSendNums");
|
||||
Object programOrderIds = cacheService.get(tenantId, waimaiType +"_" + storeId);
|
||||
|
||||
if (programOrderIds != null) {
|
||||
Map<String, String> orderIds = (Map<String, String>) cacheService.get(tenantId, waimaiType +"_" + storeId);
|
||||
if(orderIds.containsKey(orderId)){
|
||||
if(reSendNums < 5){
|
||||
reSendNums = reSendNums + 1;
|
||||
if(cancelOrder != null){
|
||||
Map<String, String> order = new HashMap<>();
|
||||
order.put(cancelOrder, orderId);
|
||||
order.put("date", fmt.format(new Date()));
|
||||
if (orderId != null && !"".equals(orderId)) {
|
||||
mqttClient.Publish("waimai/cy2/" + tenantId + "/" + storeId, JSONUtil.toJSONString(order));
|
||||
logger.error(" mqtt 推送信息 ,waimai/cy2/" + tenantId + "/" + storeId, JSONUtil.toJSONString(order));
|
||||
} else {
|
||||
logger.error( " mqtt 推送信息 ,waimai未发布");
|
||||
}
|
||||
}else{
|
||||
String ids = "";
|
||||
for (Map.Entry<String, String> entry : orderIds.entrySet()) {
|
||||
ids = ids + entry.getKey() + ",";
|
||||
}
|
||||
if (ids.length() > 0) {
|
||||
ids = ids.substring(0, ids.length() - 1);
|
||||
}
|
||||
if (ids != null && !"".equals(ids)) {
|
||||
Map<String, String> order = new HashMap<>();
|
||||
order.put(waimaiType, ids);
|
||||
order.put("date", fmt.format(new Date()));
|
||||
order.put("orderType", orderType);
|
||||
mqttClient.Publish("waimai/cy2/" + tenantId + "/" + storeId, JSONUtil.toJSONString(order));
|
||||
logger.error( " mqtt 推送信息 ," + tenantId + "/" + storeId+"/order:{}", JSONUtil.toJSONString(order));
|
||||
} else {
|
||||
logger.error( "mqtt 推送信息,"+tenantId+","+storeId+","+orderId+",未发布");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,Object> orderMap = new HashMap<>();
|
||||
orderMap.put("tenantId",tenantId);
|
||||
orderMap.put("waimaiType",waimaiType);
|
||||
if(cancelOrder != null){
|
||||
orderMap.put("cancelOrder",cancelOrder);
|
||||
}
|
||||
orderMap.put("orderType",orderType);
|
||||
orderMap.put("storeId",storeId);
|
||||
orderMap.put("orderId",orderId);
|
||||
orderMap.put("reSendNums",reSendNums);
|
||||
mqMessageSender.send4waimaiordermessage(tenantId,orderMap,new CorrelationData(UUID.randomUUID().toString()),1000L*90);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
}catch (Exception e){
|
||||
logger.error("MQ消息(外卖订单推送)处理发生异常", e);
|
||||
// 确认消息成功消费
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.jwsaas.mqtt;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MqttConfiguration {
|
||||
|
||||
@Value("${mqtt.clientId:clientId}")
|
||||
private String clientId;
|
||||
|
||||
@Value("${mqtt.host:0.0.0.0}")
|
||||
private String mqttHost;
|
||||
|
||||
@Value("${mqtt.port:1883}")
|
||||
private Integer mqttPort;
|
||||
|
||||
@Value("${mqtt.keepalive:60}")
|
||||
private int keepAlive;
|
||||
|
||||
@Value("${mqtt.connection.timeout:10}")
|
||||
private Integer connectionTimeout;
|
||||
|
||||
@Value("${mqtt.username:admin}")
|
||||
private String userName;
|
||||
|
||||
@Value("${mqtt.passwd:admin}")
|
||||
private String passwd;
|
||||
|
||||
@Bean(initMethod = "init")
|
||||
public MqttClientExt mqttClient() {
|
||||
|
||||
MqttClientExt mqttClient = new MqttClientExt();
|
||||
|
||||
mqttClient.setClientId(clientId);
|
||||
|
||||
mqttClient.setHost(mqttHost);
|
||||
mqttClient.setPort(mqttPort);
|
||||
mqttClient.setKeepAlive(keepAlive);
|
||||
mqttClient.setConnectionTimeout(connectionTimeout);
|
||||
mqttClient.setUserName(userName);
|
||||
mqttClient.setPasswd(passwd);
|
||||
|
||||
return mqttClient;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.jwsaas.mqtt;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PushCallback implements MqttCallback {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(PushCallback.class);
|
||||
|
||||
@Override
|
||||
public void connectionLost(Throwable cause) {
|
||||
logger.error("连接失败,原因", cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage message) throws Exception {
|
||||
// subscribe后得到的消息会执行到这里面
|
||||
logger.debug("接收消息主题:" + topic);
|
||||
logger.debug("接收消息Qos:" + message.getQos());
|
||||
logger.debug("接收消息内容:" + new String(message.getPayload()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||
// publish后会执行到这里
|
||||
logger.debug("消息发送成功!" + ((token == null || token.getResponse() == null) ? "null" : token.getResponse().getKey()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.jwsaas.mqtt;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Topic {
|
||||
|
||||
public static String cardPayMsg = "%s:%s:pay";
|
||||
|
||||
private String topicName; // 主题名称
|
||||
|
||||
private String tenantId; // 企业编号
|
||||
|
||||
private String shopNo; // 门店编号
|
||||
|
||||
private String posNo; // pos编号
|
||||
|
||||
private String workerNo; // 员工编号
|
||||
|
||||
private Map<String, Object> ext; // 附加信息
|
||||
|
||||
public String getTopicName() {
|
||||
return topicName;
|
||||
}
|
||||
|
||||
public void setTopicName(String topicName) {
|
||||
this.topicName = topicName;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getShopNo() {
|
||||
return shopNo;
|
||||
}
|
||||
|
||||
public void setShopNo(String shopNo) {
|
||||
this.shopNo = shopNo;
|
||||
}
|
||||
|
||||
public String getPosNo() {
|
||||
return posNo;
|
||||
}
|
||||
|
||||
public void setPosNo(String posNo) {
|
||||
this.posNo = posNo;
|
||||
}
|
||||
|
||||
public String getWorkerNo() {
|
||||
return workerNo;
|
||||
}
|
||||
|
||||
public void setWorkerNo(String workerNo) {
|
||||
this.workerNo = workerNo;
|
||||
}
|
||||
|
||||
public Map<String, Object> getExt() {
|
||||
return ext;
|
||||
}
|
||||
|
||||
public void setExt(Map<String, Object> ext) {
|
||||
this.ext = ext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Topic [topicName=" + topicName + ", shopNo=" + shopNo + ", posNo=" + posNo + ", workerNo=" + workerNo + ", ext=" + ext + "]";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.jwsaas.util;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class JSONException extends RuntimeException {
|
||||
|
||||
public JSONException(){
|
||||
super();
|
||||
}
|
||||
|
||||
public JSONException(String message){
|
||||
super(message);
|
||||
}
|
||||
|
||||
public JSONException(String message, Throwable cause){
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package com.jwsaas.util;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.core.JsonEncoding;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationConfig;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
public class JSONUtil {
|
||||
|
||||
protected static Logger logger = LoggerFactory.getLogger(JSONUtil.class);
|
||||
|
||||
private static ObjectMapper objectMapper = new ObjectMapper();
|
||||
private static final String charsetName = "UTF-8";
|
||||
|
||||
static {
|
||||
objectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
SerializationConfig serializationConfig = objectMapper.getSerializationConfig();
|
||||
serializationConfig = serializationConfig.without(SerializationFeature.WRAP_ROOT_VALUE)
|
||||
.with(SerializationFeature.INDENT_OUTPUT);
|
||||
SerializerProvider serializerProvider = objectMapper.getSerializerProvider();
|
||||
serializerProvider.setNullValueSerializer(new JsonSerializer<Object>() {
|
||||
|
||||
@Override
|
||||
public void serialize(Object value, JsonGenerator jgen, SerializerProvider serializers)
|
||||
throws IOException, JsonProcessingException {
|
||||
jgen.writeString("");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// public static ObjectMapper getObjectMapper() {
|
||||
// return CollectionUtils.deepCopy(objectMapper);
|
||||
// }
|
||||
|
||||
public static String toJSONString(Object object) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
|
||||
try {
|
||||
JsonGenerator jsonGenerator = objectMapper.getFactory().createGenerator(bos, JsonEncoding.UTF8);
|
||||
objectMapper.writeValue(jsonGenerator, object);
|
||||
return bos.toString(charsetName);
|
||||
} catch (Exception e) {
|
||||
throw new JSONException(e.getMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
bos.close();
|
||||
} catch (Exception ex) {
|
||||
logger.error("toJSONString(bos.close) Exception ", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static JsonNode parseJsonNode(String text) {
|
||||
try {
|
||||
return objectMapper.readTree(text);
|
||||
} catch (Exception e) {
|
||||
throw new JSONException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T parseObject(String text, Class<T> clazz) {
|
||||
try {
|
||||
return objectMapper.readValue(text, clazz);
|
||||
} catch (Exception e) {
|
||||
throw new JSONException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T parseObject(String text, Class<T> clazz, String charsetName) {
|
||||
try {
|
||||
return objectMapper.readValue(text.getBytes(charsetName), clazz);
|
||||
} catch (Exception e) {
|
||||
throw new JSONException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T parseObject(String text, TypeReference<T> valueTypeRef) {
|
||||
try {
|
||||
return objectMapper.readValue(objectMapper.getFactory().createParser(text), valueTypeRef);
|
||||
} catch (Exception e) {
|
||||
throw new JSONException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static ObjectNode createObjectNode() {
|
||||
try {
|
||||
return objectMapper.createObjectNode();
|
||||
} catch (Exception e) {
|
||||
throw new JSONException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从json中读取tagPath处的值 tagPath用 :分隔
|
||||
*
|
||||
* @param json
|
||||
* @param tagPath
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static List<String> readValueFromJson(String json, String tagPath) throws Exception {
|
||||
// 返回值
|
||||
List<String> value = new ArrayList<String>();
|
||||
if (StringUtils.isBlank(json) || StringUtils.isBlank(tagPath)) {
|
||||
return value;
|
||||
}
|
||||
String[] path = tagPath.split(":");
|
||||
JsonNode node = objectMapper.readTree(json);
|
||||
getJsonValue(node, path, value, 1);
|
||||
return value;
|
||||
}
|
||||
|
||||
public static void getJsonValue(JsonNode node, String[] path, List<String> values, int nextIndex) {
|
||||
if (node == null) {
|
||||
return;
|
||||
}
|
||||
// 是路径的最后就直接取值
|
||||
if (nextIndex == path.length) {
|
||||
if (node.isArray()) {
|
||||
for (int i = 0; i < node.size(); i++) {
|
||||
JsonNode child = node.get(i).get(path[nextIndex - 1]);
|
||||
if (child == null) {
|
||||
continue;
|
||||
}
|
||||
values.add(child.toString());
|
||||
}
|
||||
} else {
|
||||
JsonNode child = node.get(path[nextIndex - 1]);
|
||||
if (child != null) {
|
||||
values.add(child.toString());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 判断是Node下是集合还是一个节点
|
||||
node = node.get(path[nextIndex - 1]);
|
||||
if (node.isArray()) {
|
||||
for (int i = 0; i < node.size(); i++) {
|
||||
getJsonValue(node.get(i), path, values, nextIndex + 1);
|
||||
}
|
||||
} else {
|
||||
getJsonValue(node, path, values, nextIndex + 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,50 @@
|
||||
#application
|
||||
application.name=food-waimai-mq
|
||||
application.owner=
|
||||
|
||||
#RabbitMQ
|
||||
spring.rabbitmq.host=192.168.0.110
|
||||
spring.rabbitmq.port=5672
|
||||
spring.rabbitmq.virtualHost=/dev_test
|
||||
spring.rabbitmq.publisherConfirms=true
|
||||
spring.rabbitmq.username=dev
|
||||
spring.rabbitmq.password=dev
|
||||
|
||||
# Dubbo service version
|
||||
food.service.group=default
|
||||
food.service.version=2.0.0
|
||||
|
||||
# Base packages to scan Dubbo Component: @com.alibaba.dubbo.config.annotation.Service
|
||||
dubbo.scan.basePackages=com.jwsaas
|
||||
|
||||
# Dubbo Config properties
|
||||
## ApplicationConfig Bean
|
||||
dubbo.application.id=food-waimai-mq
|
||||
dubbo.application.name=food-waimai-mq
|
||||
dubbo.application.qos-enable=false
|
||||
dubbo.application.qos-port=22222
|
||||
|
||||
## ConsumerConfig Bean
|
||||
dubbo.consumer.id=dubbo
|
||||
dubbo.consumer.name=dubbo
|
||||
dubbo.consumer.client=netty4
|
||||
|
||||
## RegistryConfig Bean
|
||||
dubbo.registry.id=food-registry
|
||||
dubbo.registry.address=zookeeper://127.0.0.1:2181
|
||||
dubbo.registry.client=curator
|
||||
dubbo.registry.file=/home/project/foodv2/dubbo/food-waimai-mq.cache
|
||||
|
||||
## consume
|
||||
dubbo.consumer.timeout=600000
|
||||
# \u670D\u52A1\u542F\u52A8\u65F6\u68C0\u67E5\u88AB\u8C03\u7528\u670D\u52A1\u662F\u5426\u53EF\u7528
|
||||
dubbo.consumer.check=true
|
||||
dubbo.consumer.retries=0
|
||||
|
||||
#MQTT
|
||||
mqtt.clientId=cy2_waimaimq_local_test
|
||||
mqtt.host=iotv2.ffcygl.com
|
||||
mqtt.port=18830
|
||||
mqtt.keepalive=60
|
||||
mqtt.connection.timeout=10
|
||||
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="APP_Name" value="estore-mq" />
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%-5level] %logger{120} - %msg %n</Pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework.core" level="INFO" />
|
||||
<logger name="org.springframework.beans" level="INFO" />
|
||||
<logger name="org.springframework.context" level="INFO" />
|
||||
<logger name="org.springframework.aop" level="INFO" />
|
||||
<logger name="org.springframework.boot.autoconfigure.logging" level="INFO" />
|
||||
<logger name="org.apache.zookeeper" level="INFO" />
|
||||
<logger name="com.alibaba.dubbo" level="INFO" />
|
||||
<!-- <logger name="com.jwsaas" level="DEBUG" /> -->
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
Loading…
Reference in New Issue