添加http adapter相關(guān)的jar包依賴(lài)
- 上傳http adapter 依賴(lài)的jar
mkdir lib-io
cp httpcore-4.0.1.jar lib-io/
cp httpcore-nio-4.0.1.jar lib-io/
cp httpclient-4.0.1.jar lib-io/
## 添加如下依賴(lài)
LIB_IO=$BASEDIR/lib-io
# Esper io
#
CLASSPATH=$CLASSPATH:$LIB/esperio-http-6.0.1.jar
CLASSPATH=$CLASSPATH:$LIB_IO/httpcore-4.0.1.jar
CLASSPATH=$CLASSPATH:$LIB_IO/httpclient-4.0.1.jar
CLASSPATH=$CLASSPATH:$LIB_IO/httpcore-nio-4.0.1.jar
##可以試下
##CLASSPATH=$CLASSPATH:$LIB_IO/*
部署epl(2選1)
直接部署epl
module cn.wanda.tech.esper.quickstart;
@Name('Request')
create schema Request(uuid string,msg string);
@Name('Response')
create schema Response(uuid string,msg string);
@Name('Process')
On Request insert into Response select *;
@Name('Display')
select * from Response
cp echo.epl hotdeploy/
通過(guò)war包部署(方便統(tǒng)一管理依賴(lài)的各種udf等)
git clone https://git.oschina.net/wangpeibin/esper-job.git
- 導(dǎo)入esper-job-quickstart
- 添加需要使用的java class和方法
- 生成war包
mvn package
cp target/xxxxx.war hotdeploy/
配置輸出
<plugin-loader name="EsperIOHTTPAdapter" class-name="com.espertech.esperio.http.EsperIOHTTPAdapterPlugin">
<config-xml>
<esperio-http-configuration>
<!-- 輸入 -->
<service name="myservice" port="8079" nio="true"/>
<get service="myservice" pattern="*"/>
<!-- 輸出 -->
<request stream="Response" uri="http://127.0.0.1:8080/callback"/>
</esperio-http-configuration>
</config-xml>
</plugin-loader>
sh bin/esperee.sh stop
# 可能需要等一陣 等待完全退出
sh bin/esperee.sh start
接受http adapter的輸出
- 使用spring boot 快速搭建服務(wù)
- 添加 controller
@Controller
public class EventController {
private static Logger log = LoggerFactory.getLogger(EventController.class);
@ResponseBody
@RequestMapping(value = "/callback", method = RequestMethod.GET)
public void callback(HttpServletRequest request) {
log.info("callback {} {}", request.getRequestURI(), request.getQueryString());
}
}
- 啟動(dòng)spring boot 服務(wù)
mvn spring-boot:run
往http adapter 發(fā)送請(qǐng)求
wget http://127.0.0.1:8079/sendevent?stream=Request&msg=Joe
驗(yàn)證結(jié)果
- spring boot服務(wù)有相應(yīng)的log輸出
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。