小编ade*_*ady的帖子

使用kafka作为消息代理为桌面/移动/ Web应用程序创建实时推送通知系统

我有一个用例,需要按照发布/订阅消息传递模式在服务器和客户端之间进行实时通信.生产者将是java,节点等服务器,客户端将是 - java桌面应用程序,移动应用程序(android/ios),浏览器(javascript).

我已经探讨了下面讨论的许多选项,但我无法提出强大的可扩展解决方案.

使用案例:服务器将发布各种主题的通知/消息,订阅一组主题的所有客户端(java/js/ios)将实时获取这些消息.

我按照3种方法解决了这个问题1> socketIo/socketcluster 2>使用mosquitto/rabbitmq作为代理探索了mqtt协议.3>探索卡夫卡

主要目标是使该架构具有高度可扩展性,不仅可以同时拥有超过百万个客户端连接,而且每秒可以发布和消耗超过百万条消息.

第一种方法很简单,但它可以工作,但webSocket不是可扩展的解决方案.

第二种方法可行,但是rabbitmq将创建大量队列(百万个客户端的百万个队列),因为它为每个连接到它的客户端维护队列,而且RabbitMq没有高消息发布和消耗率,加上假设我们有一个集群RabbitMQ的节点那么只有一个节点用于处理请求和其他的用于高可用性,但不平行的消耗.

第三,我探索了kafka,它以我的基准着称,我使用kafka的高级java api在java中创建客户端,可以用来订阅kafka主题,并且发布到该主题的任何消息都可以实时传递给客户端.

所以我的问题是使用kafka客户端进行实时推送通知有多好,其中所有的Java桌面应用程序(可能是一百万)将包含这个kafka java客户端sdk并将订阅某些主题,在这里我对待每个客户端作为消费者群体.

而且,这里一个主要问题是,这卡夫卡的客户是规模大,由于其阶依赖,因此使用此客户端Android将不会是一个很好的选择,也是我不认为它会奏效.

MQTT擅长在这里,因为它有针对Android,JAVA,IOS等官方phao客户

此外,我还没有在网上使用kafka看到用于百万消费者的发布/订阅消息传递的示例,大多数人正在将其用于数据管道,例如:实时日志处理,向HDFS提供数据,分析引擎等,流处理.

主要问题是我如何使用mqtt协议(适用于android/ios/web/iot)和kafka作为消息代理(具有较高的发布/订阅率)并为此问题提出可扩展的解决方案.

我的用例在某种程度上也类似于uber,其中有数百万的android/ios设备(客户端),我们实际上可以看到我们在地图上所有汽车的实时移动,有没有人知道后面的架构是什么这些实时跟踪汽车.

scalability real-time publish-subscribe rabbitmq apache-kafka

16
推荐指数
1
解决办法
8502
查看次数

在多个工作中重复使用jenkins管道的各个阶段

我的团队正在转向Jenkins 2,我正在使用管道插件,以便我们的构建可以存在于我们的存储库中.因为在我们公司中获得分配的存储库有很多开销,所以我们有一个存储库,其中包含许多子项目和子模块.

我想要的是为每个子模块单独构建和报告Junit/checkstyle/etc报告,以及每个子项目的最终"构建和部署"步骤.

我目前的计划是为每个子模块创建单独的作业,以便他们获得自己的junit/checkstyle/etc报告页面.然后有一个多作业项目来为子项目编排子模块构建.由于所有子项目都是简单的jar构建,我想将大量逻辑放在一个公共文件中,让我们在子项目的根目录中调用它为JenkinsfileForJars.回购结构是

  • 子项目
    • JenkinsfileForJars.groovy
    • 子moduleA
      • Jenkinsfile
    • 子moduleB
      • Jenkinsfile

我的Jenkinsfile包含

def submoduleName = "submoduleA"
def pipeline
node {

    pipeline = load("${env.WORKSPACE}/subproject/JenkinsfileForJars.groovy")

}
pipeline.build()
pipeline.results()
Run Code Online (Sandbox Code Playgroud)

我的JenkinsfileForJars包含

def build() {

    stage('Build') {
        // Run the maven build
        dir("subproject") {
            sh "./gradlew ${submoduleName}:build"
        }

    }
}
def results() {

    stage('Results') {
        dir("subproject/${submoduleName}") {
            junit 'build/test-results/TEST-*.xml'
            archive 'build/libs/*.jar'
            publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/reports/cobertura/', reportFiles: 'frame-summary.html', reportName: 'Cobertura Report'])
            publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/reports/findbugs/', reportFiles: 'main.html', …
Run Code Online (Sandbox Code Playgroud)

jenkins jenkins-pipeline

9
推荐指数
1
解决办法
5397
查看次数

如何获取Grails/Tomcat Webapp的当前工作目录?

我为Tomcat写了一个Grails webapp,它打开并从./data/transactions/foobar上的Berkeley DB中读取.

这个代码在我的Eclipse环境中运行良好.

但是当我将它移动到服务器时,它会吐出这个异常.当我将WAR文件中的Grails部署为服务器上的webapps Web应用程序时,我不确定当前工作目录的位置.

com.sleepycat.je.EnvironmentNotFoundException: (JE 4.1.10) ./data/transactions/Foobar
Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no log files in the environment directory. Environment is invalid and must be closed.
Run Code Online (Sandbox Code Playgroud)

Linux服务器上的我的Tomcat安装目录是/ usr/share/tomcat6.webapps root目录是/ usr/share/tomcat6/webapps.我们的WAR目录安装在名为"bridge"的子目录中.我的Grails应用程序的WAR路径位于/ usr/share/tomcat6/webapps/bridge中

我尝试将./data/transaction/Foobar放在/ usr/share/tomcat6/webapps和/ usr/share/tomcat6/webapps/bridge中,没有运气.

我也尝试将./data/transaction/Foobar放入/ usr/share/tomcat6安装基目录,也没有运气.

以下是我从Tomcat服务器看到的错误:

Error 500: Executing action [index] of controller[com.ecmhp.ecmdatabridge.generators.GenerateEmiDigestsController] 
caused exception: (JE 4.1.10) ./data/transactions/Foobar 
    Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
    EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no …
Run Code Online (Sandbox Code Playgroud)

grails tomcat working-directory

5
推荐指数
2
解决办法
5538
查看次数

gradle spring boot starter-logging失败并出现Logback错误

我有一个spring-boot启动web应用程序.最近我收到了与Logback相关的错误.以下是我当前的gradle文件:

buildscript {
    ext {
        springBootVersion = '1.3.1.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    classpath('io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE')
    classpath 'net.saliman:gradle-cobertura-plugin:2.3.0'
    }
}

apply plugin: 'groovy'
apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'


repositories {
    mavenCentral()
}

configurations {
    providedRuntime
}

configurations {
    all*.exclude module: 'spring-boot-starter-logging'
}

dependencies {
    compile 'com.github.groovy-wslite:groovy-wslite:1.1.2'
    compile('org.springframework.boot:spring-boot-starter-web') 

    compile("org.springframework.boot:spring-boot-starter-data-rest")
    compile("org.springframework.boot:spring-boot-starter-data-jpa") 
    compile('org.springframework.boot:spring-boot-starter-log4j')
    compile('org.codehaus.groovy:groovy')
    compile("org.apache.accumulo:accumulo-core:1.6.2") {
        exclude module: "slf4j-log4j12"
    }

    compile("com.h2database:h2")

    providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
    testCompile('org.springframework.boot:spring-boot-starter-test')

    testCompile 'com.github.groovy-wslite:groovy-wslite:1.1.2'
    testCompile 'org.codehaus.groovy:groovy-json:2.4.5'
    testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
    testCompile 'org.spockframework:spock-spring:1.0-groovy-2.4'
    testCompile 'cglib:cglib-nodep:3.1'

}

tasks.withType(Test) {
    systemProperty 'spring.profiles.active', …
Run Code Online (Sandbox Code Playgroud)

gradle spring-boot

3
推荐指数
1
解决办法
1701
查看次数