博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
storm与spring结合开发
阅读量:7007 次
发布时间:2019-06-27

本文共 2021 字,大约阅读时间需要 6 分钟。

hot3.png

一、storm引入pom.xml注意用log4j2版本,防止与storm自己的log4j2冲突

即storm日志这块直接用storm本身的不需要额外加

        <dependency>

            <groupId>org.apache.storm</groupId>
            <artifactId>storm-core</artifactId>
            <version>1.0.2</version>
            <scope>provided</scope>
        </dependency>

二、spring容器单例实现,保证每个插槽,即jvm仅有一个spring容器 

** *  * spring上下文单例实现,传说中的双重效验锁 *  * @author lli * @version [版本号, 2016年9月21日] * @see [相关类/方法] * @since [产品/模块版本] */public class SingletonCTX {    private static Logger                                  LOGGER = LoggerFactory.getLogger(SingletonCTX.class);    private volatile static ConfigurableApplicationContext CTX;    private SingletonCTX() {}    public static ConfigurableApplicationContext getInstance() {        if (CTX == null) {            synchronized (SingletonCTX.class) {                if (CTX == null) {                    CTX = new ClassPathXmlApplicationContext("applicationContext.xml");                    LOGGER.info("------------------------------加载Spring环境。-----------------------------");                }            }        }        return CTX;    }}

三、打包发布问题

开发环境项目分包如下

parent

domain
core
util
storm

storm pom.xml

maven-assembly-plugin
2.4
com.wttech.gnss.storm.topology.StormTopology
assembly.xml

与pom.xml同级文件assembly.xml

jar-with-dependencies
jar
false
/
true
true
com.wttech.gnss:gnss-core
com.wttech.gnss:gnss-msg
com.wttech.gnss:gnss-storm

打包命令 assembly:assembly

注意打完后 只要**-jar-with-dependencies.jar 但是这个jar所需依赖包并没打进去,需要把所需要的第三方jarcopy到每个节点的storm的extbin目录下。

转载于:https://my.oschina.net/chuibilong/blog/802053

你可能感兴趣的文章
反编译工具jad使用方法
查看>>
STL 容器和迭代器连载5_顺序容器的操作2
查看>>
mysql常用语句
查看>>
jQuery 入门教程(12): HTML Get
查看>>
django 上传,下载excel
查看>>
剑指OFFER之重建二叉树(九度OJ1385)
查看>>
caj转pdf——包含下载链接
查看>>
自己写的一个CRC校验工具
查看>>
多个AsyncTask 相互阻塞的原因
查看>>
CentOS安装squid代理服务器
查看>>
CMD命令集-Color
查看>>
android 消息推送 记录
查看>>
Java文件下载
查看>>
Mybatis #{} 与 ${} 区别
查看>>
java体系和微软体系
查看>>
js bind() 第一个参数为null
查看>>
dubbo序列化问题(一)浮点数问题
查看>>
git stash
查看>>
mysql 多个实例
查看>>
memcached 常用命令及使用说明
查看>>