初始化客户端的配置

pull/13/head
3y 2 years ago
parent 530001a0bf
commit b94d80f6b9

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>austin</artifactId>
<groupId>com.java3y.austin</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>austin-client</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.java3y.austin</groupId>
<artifactId>austin-service-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,63 @@
package com.java3y.austin.client.service;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.java3y.austin.service.api.domain.MessageParam;
import com.java3y.austin.service.api.domain.SendRequest;
import com.java3y.austin.service.api.domain.SendResponse;
import com.java3y.austin.service.api.enums.BusinessCode;
/**
*
*
* @author 3y
*/
public class AustinService {
private static final String SEND_PATH = "/send";
private static final String RECALL_PATH = "/messageTemplate/recall";
/**
*
*
* @param host host
* @param sendRequest
* @return
* @throws Exception
*/
public static SendResponse send(String host, SendRequest sendRequest) throws Exception {
String url = host + SEND_PATH;
String result = HttpUtil.post(url, JSONUtil.toJsonStr(sendRequest));
return JSONUtil.toBean(result, SendResponse.class);
}
/**
* ID
*
* @param host host
* @param id ID
* @return
* @throws Exception
*/
public static SendResponse recall(String host, String id) throws Exception {
String url = host + RECALL_PATH + StrUtil.SLASH + id;
String result = HttpUtil.post(url, id);
return JSONUtil.toBean(result, SendResponse.class);
}
public static void main(String[] args) {
SendRequest request = SendRequest.builder().code(BusinessCode.COMMON_SEND.getCode())
.messageTemplateId(68L)
.messageParam(MessageParam.builder().receiver("phone").build()).build();
try {
AustinService.send("url", request);
} catch (Exception e) {
System.out.println(e);
}
}
}

@ -136,7 +136,7 @@ public class MessageTemplateController {
}
/**
*
*
*/
@PostMapping("recall/{id}")
@ApiOperation("/撤回消息接口")

@ -13,5 +13,5 @@ EXPOSE 8080
# 运行jar包
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS austin.jar $PARAMS"]
# docker run -e PARAMS="--austin.database.ip= --austin.database.port=3306 --austin.redis.ip= --austin.mq.pipeline=eventbus " -p 8080:8080 --name austin:1.0
# docker build -t austin:0.1 .
# docker run -e PARAMS="--austin.database.ip= --austin.database.port=3306 --austin.redis.ip= --austin.mq.pipeline=eventbus " -p 8080:8080 --name austin:0.1

@ -13,6 +13,7 @@
<module>austin-handler</module>
<module>austin-cron</module>
<module>austin-stream</module>
<module>austin-client</module>
</modules>
<parent>

Loading…
Cancel
Save