zoukankan      html  css  js  c++  java
  • 如何在Crystal框架项目中内置启动MetaQ服务?

    当Crystal框架项目中需要使用消息机制,而项目规模不大、性能要求不高时,可内置启动MetaQ服务器。

    分步指南

    项目引入crystal-extend-metaq模块,如下:

    <dependency>
        <groupId>com.gsoft.crystal</groupId>
        <artifactId>crystal-extend-metaq</artifactId>
    </dependency>

    服务器默认参数如下:

    [system]
    brokerId=0
    hostName=192.168.1.150
    numPartitions=6
    serverPort=8123
    dashboardHttpPort=8120
    unflushThreshold=0
    unflushInterval=10000
    maxSegmentSize=1073741824
    maxTransferSize=1048576
    deletePolicy=delete,168
    deleteWhen=0 0 6,18 * * ?
    flushTxLogAtCommit=1
    stat=true
    ;; Update consumers offsets to current max offsets when consumers offsets are out of range of current broker's messages.
    ;; It must be false in production.But recommend to be true in development or test.
    updateConsumerOffsets=true
    [zookeeper]
    zk.zkConnect=localhost:2181
    zk.zkSessionTimeoutMs=30000
    zk.zkConnectionTimeoutMs=30000
    zk.zkSyncTimeMs=5000
    ;; Topics section
    [topic=test]
    [topic=meta-test]

    可在项目src/main/resource/metaq目录下,创建service.ini文件,并将以上默认内容复制到文件中后,修改相应内容;

    若项目中存在service.ini文件,则优先作为MetaQ服务启动的配置文件。

    启动项目是,MetaQ服务将自动启动。


    如对MetaQ服务器性能要求较高,需要集群等,请单独部署MetaQ服务器。

  • 相关阅读:
    Python基础
    pip install psycopg2出现python setup.py egg_info failed with error code 1 in /tmp/pip-build-YtLeN3/psycopg2错误处理
    Python基础
    C语言基础
    benchmarks
    用 MuGo 搭建 Go Engine 在 KGS 对战
    GPU
    linux 杀掉僵尸进程 (zombie process, defunct)
    CMakeLists.txt 语法
    软件列表(按字母排序)
  • 原文地址:https://www.cnblogs.com/jytx/p/5482010.html
Copyright © 2011-2022 走看看