ZE-Consumer Deployment

Prerequisites

Consumer Service Deployment (Jar)

  1. Create a directory under folder opt “zephyrservice”

    mkdir zephyrservice

  2. Download the ze-rabbitmq-consumer.jar and copy it under zephyrservice.

  3. Create a ze-rabbitmq-consumer config file Named zeRabbitMQConsumer.properties under the folder zephyrservice

    vi zeRabbitMQConsumer.properties

  4. Add the below line in the file zeRabbitMQConsumer.properties:

    #Consumer Service port
    server.port=8082
    
    # Rabbitmq config
    zephyr.queue.name=ze_queue
    zephyr.queue.exchange=ze_exchange
    zephyr.queue.routing.key=ze_routing_key
    spring.rabbitmq.listener.simple.prefetch=1
    
    spring.rabbitmq.host=<rabbitmq_hostname>
    spring.rabbitmq.port=<rabbitmq_port>
    spring.rabbitmq.username=<rabbitmq_username>
    spring.rabbitmq.password=<rabbitmq_password>
    spring.rabbitmq.ssl.enabled=true
    
    # Activate Profile {dbType} = mysql/mssql/oracle, {queueType} = artemis/rabbitmq
    spring.profiles.active={dbType},{queueType}
    spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration 
    # Audit service configurations
    audit.service.baseUrl=http://localhost:8083
    
    # Zephyr service configurations
    zephyr.service.baseUrl=http://localhost:8080
    
    # webhook service url 
    zephyr.rabbitmq.webhook.baseUrl=http://localhost:8081/webhook
    
    # Jira retry callback configurations
    # BackOffDelay allows dynamic calculation of the delay between retry attempts 
    zephyr.jiracall.retry.backOffDelay=500
    # multiplier allows dynamic calculation of the multiplier factor for exponential backoff
    zephyr.jiracall.retry.multiplier=2
    # maxAttempts specifies the maximum number of retry attempts for the jira call.
    zephyr.jiracall.retry.maxAttempts=1
    
    #Consumer count
    spring.rabbitmq.consumer.count=1

Append the below database-specific properties based on the Zephyr database you are using.

MsSQL

# Data source configurations applied for mssql
---
---
spring.config.activate.on-profile=mssql
spring.datasource.url=jdbc:sqlserver://<database_ipaddress>:<database_port>;database=itcc;encrypt=true;trustServerCertificate=true
spring.datasource.username=<datbase_username>
spring.datasource.password=<database_password>
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect

MySQL

# Data source configurations applied for mysql
---
---
spring.config.activate.on-profile=mysql
spring.datasource.url=jdbc:mysql://<database_ipaddress>:<database_port>/itcc?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=<datbase_username>
spring.datasource.password=<database_password>
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
 

Oracle

# Data source configurations applied for oracle
---
---
spring.config.activate.on-profile=oracle
spring.datasource.url=jdbc:oracle:thin:@<hostname>:<port>:orcl
spring.datasource.username=<datbase_username>
spring.datasource.password=<database_password>
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.jpa.properties.hibernate.default_schema=itcc
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.OracleDialect
 

An example of zeRabbitMQConsumer.properties for MYSQL DB would look like the below:

#Consumer Service port
server.port=8082

# Rabbitmq config
zephyr.queue.name=ze_queue
zephyr.queue.exchange=ze_exchange
zephyr.queue.routing.key=ze_routing_key
spring.rabbitmq.listener.simple.prefetch=1

spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
spring.rabbitmq.ssl.enabled=true

# Activate Profile {dbType} = mysql/mssql/oracle, {queueType} = artemis/rabbitmq
spring.profiles.active=mysql,rabbitmq

# Audit service configurations
audit.service.baseUrl=http://localhost:8083

# Zephyr service configurations
zephyr.service.baseUrl=http://localhost:8080

# webhook service url 
zephyr.rabbitmq.webhook.baseUrl=http://localhost:8081/webhook

# Jira retry callback configurations
# BackOffDelay allows dynamic calculation of the delay between retry attempts 
zephyr.jiracall.retry.backOffDelay=500
# multiplier allows dynamic calculation of the multiplier factor for exponential backoff
zephyr.jiracall.retry.multiplier=2
# maxAttempts specifies the maximum number of retry attempts for the jira call.
zephyr.jiracall.retry.maxAttempts=1

#Consumer count
spring.rabbitmq.consumer.count=1

# Data source configurations applied for mysql
---
---
spring.config.activate.on-profile=mysql
spring.datasource.url=jdbc:mysql://localhost:3306/itcc?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect

  • Open the “Terminal” or “Command Prompt”

  • Navigate to folder /opt/zephyrservice

  • Type the below command

Start the ze-jira-webhook with the following command.

sudo nohup java -jar -Dspring.profiles.active=DB,queue_name -DzeConsumerConfigPath="<config file path till root folder>" ze-rabbitmq-consumer.jar &

Example command for mysql:

sudo nohup java -jar -Dspring.profiles.active=mysql,rabbitmq -DzeConsumerConfigPath="/opt/zephyrservice" ze-rabbitmq-consumer.jar &

Note

The Logs folder will be created where your jars are deployed. Separate log files will be created for each jar. In the above example, it will be in /opt/zephyrservice

Consumer Service Deployment (Docker)

  • Install Docker in the System

  • Create a directory under folder opt “zephyrservice”

    mkdir zephyrservice

  • Download the Docker compose and copy it under zephyrservice

    #dockercompose
    version: '3.5'
    services:
      #consumerservice
      ze-rabbitmq-consumer:
        image: smartbear/zerabbitmqconsumer:ze-rabbitmq-consumer
        container_name: ze-rabbitmq-consumer
        ports:
          - "8082:8082"
        environment:
          - server_port=8082
        volumes:
          - ./zeRabbitMQConsumer.properties:/usr/src/app/zeRabbitMQConsumer.properties
        networks:
          - consumer_service
    networks:
      consumer_service:
        name: zephyr
        external: true
  • Create a ze-rabbitmq-consumer config file Named "zeRabbitMQConsumer.properties" under folder zephyrservice

    vi zeRabbitMQConsumer.properties

  • Add the below line to the file:

    #Consumer Service port
    server.port=8082
    # Rabbitmq config
    zephyr.queue.name=ze_queue
    zephyr.queue.exchange=ze_exchange
    zephyr.queue.routing.key=ze_routing_key
    spring.rabbitmq.listener.simple.prefetch=1
    spring.rabbitmq.host=<rabbitmq_hostname>
    spring.rabbitmq.port=<rabbitmq_port>
    spring.rabbitmq.username=<rabbitmq_username>
    spring.rabbitmq.password=<rabbitmq_password>
    # Audit service configurations
    audit.service.baseUrl=http://localhost:8083
    # Zephyr service configurations
    zephyr.service.baseUrl=http://localhost:8080
    # webhook service url 
    zephyr.rabbitmq.webhook.baseUrl=http://localhost:8081/webhook
    # Jira retry callback configurations
    # BackOffDelay allows dynamic calculation of the delay between retry attempts 
    zephyr.jiracall.retry.backOffDelay=500
    # multiplier allows dynamic calculation of the multiplier factor for exponential backoff
    zephyr.jiracall.retry.multiplier=2
    # maxAttempts specifies the maximum number of retry attempts for the jira call.
    zephyr.jiracall.retry.maxAttempts=1

    Append the below database-specific properties based on the Zephyr database you are using.

MsSQL

# Data source configurations applied for mssql
---
spring.config.activate.on-profile=mssql
spring.datasource.url=jdbc:sqlserver://<database_ipaddress>:<database_port>;database=itcc;encrypt=true;trustServerCertificate=true
spring.datasource.username=<datbase_username>
spring.datasource.password=<database_password>
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
---
spring.profiles.active=mssql

MySQL

# Data source configurations applied for mysql
---
spring.config.activate.on-profile=mysql
spring.datasource.url=jdbc:mysql://<database_ipaddress>:<database_port>/itcc?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=<datbase_username>
spring.datasource.password=<database_password>
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
---
spring.profiles.active=mysql

 

Oracle

# Data source configurations applied for oracle
---
spring.config.activate.on-profile=oracle
spring.datasource.url=jdbc:oracle:thin:@<hostname>:<port>:orcl
spring.datasource.username=<datbase_username>
spring.datasource.password=<database_password>
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.jpa.properties.hibernate.default_schema=itcc
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle12cDialect
---
spring.profiles.active=oracle

# For oauth2
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

Your sample zeRabbitMQConsumer.properties should look like Below

MySQL

#Oracle would look like below:
server.port=9091
spring.rabbitmq.host=localhost
spring.rabbitmq.username=test
spring.rabbitmq.password=test
spring.datasource.username=admin
spring.datasource.password=password
#For oracle db url
spring.datasource.url=jdbc:oracle:thin:@//ze-oracle19c.c4n7zxvdu2ao.ap-southeast-
1.rds.amazonaws.com:1521/orcl
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.jpa.properties.hibernate.default_schema=itcc
spring.jpa.hibernate.ddl-auto=none
# Hibernate Properties
spring.jpa.properties.hibernate.dialect=com.thed.orm.Oracle10gCustomDialect
#Queue
zephyr.queue.name=ze_queue
zephyr.queue.exchange=ze_exchange
zephyr.queue.routing.key=ze_routing_key
spring.rabbitmq.listener.simple.prefetch=1
audit.service.url=http://localhost
audit.service.port=8082
audit.service.create.path=/v1/audit
#Consumer Service port
server.port=8082
spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=test
spring.rabbitmq.password=test

# Data source configurations applied for mysql
---
spring.config.activate.on-profile=mysql
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.url=jdbc:mysql://localhost:3306/itcc?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
---
spring.profiles.active=mysql

#Queue
zephyr.queue.name=ze_queue
zephyr.queue.exchange=ze_exchange
zephyr.queue.routing.key=ze_routing_key
spring.rabbitmq.listener.simple.prefetch=1

# Audit service configurations
audit.service.baseUrl=http://localhost:8083

# Zephyr service configurations
zephyr.service.baseUrl=http://localhost:8080

# webhook service url --> must needs to pass as vm argument
zephyr.rabbitmq.webhook.baseUrl=http://localhost:8081/webhook

# Jira retry callback configurations
# BackOffDelay allows dynamic calculation of the delay between retry attempts in millisecond
zephyr.jiracall.retry.backOffDelay=500
# multiplier allows dynamic calculation of the multiplier factor for exponential backoff
zephyr.jiracall.retry.multiplier=2
# maxAttempts specifies the maximum number of retry attempts for the jira call.
zephyr.jiracall.retry.maxAttempts=1

MSSQL

#Oracle would look like below:
server.port=9091
spring.rabbitmq.host=localhost
spring.rabbitmq.username=test
spring.rabbitmq.password=test
spring.datasource.username=admin
spring.datasource.password=password
#For oracle db url
spring.datasource.url=jdbc:oracle:thin:@//ze-oracle19c.c4n7zxvdu2ao.ap-southeast-
1.rds.amazonaws.com:1521/orcl
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.jpa.properties.hibernate.default_schema=itcc
spring.jpa.hibernate.ddl-auto=none
# Hibernate Properties
spring.jpa.properties.hibernate.dialect=com.thed.orm.Oracle10gCustomDialect
#Queue
zephyr.queue.name=ze_queue
zephyr.queue.exchange=ze_exchange
zephyr.queue.routing.key=ze_routing_key
spring.rabbitmq.listener.simple.prefetch=1
audit.service.url=http://localhost
audit.service.port=8082
audit.service.create.path=/v1/audit
#Consumer Service port
server.port=8082
spring.rabbitmq.host=localhost
spring.rabbitmq.username=test
spring.rabbitmq.password=test
# Data source configurations applied for mssql
---
spring.config.activate.on-profile=mssql
spring.datasource.username=sa
spring.datasource.password=root
spring.datasource.url=jdbc:sqlserver://localhost:1433;database=itcc;encrypt=true;trustServerCertificate=true
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
---
spring.profiles.active=mssql
#Queue
zephyr.queue.name=ze_queue
zephyr.queue.exchange=ze_exchange
zephyr.queue.routing.key=ze_routing_key
spring.rabbitmq.listener.simple.prefetch=1
# Audit service configurations
audit.service.baseUrl=http://localhost:8083
# Zephyr service configurations
zephyr.service.baseUrl=http://localhost:8080
# webhook service url --> must needs to pass as vm argument
zephyr.rabbitmq.webhook.baseUrl=http://localhost:8081/webhook
# Jira retry callback configurations
# BackOffDelay allows dynamic calculation of the delay between retry attempts in millisecond
zephyr.jiracall.retry.backOffDelay=500
# multiplier allows dynamic calculation of the multiplier factor for exponential backoff
zephyr.jiracall.retry.multiplier=2
# maxAttempts specifies the maximum number of retry attempts for the jira call.
zephyr.jiracall.retry.maxAttempts=1

Oracle

#Oracle would look like below:
server.port=9091
spring.rabbitmq.host=localhost
spring.rabbitmq.username=test
spring.rabbitmq.password=test
spring.datasource.username=admin
spring.datasource.password=password
#For oracle db url
spring.datasource.url=jdbc:oracle:thin:@//ze-oracle19c.c4n7zxvdu2ao.ap-southeast-
1.rds.amazonaws.com:1521/orcl
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.jpa.properties.hibernate.default_schema=itcc
spring.jpa.hibernate.ddl-auto=none
# Hibernate Properties
spring.jpa.properties.hibernate.dialect=com.thed.orm.Oracle10gCustomDialect
#Queue
zephyr.queue.name=ze_queue
zephyr.queue.exchange=ze_exchange
zephyr.queue.routing.key=ze_routing_key
spring.rabbitmq.listener.simple.prefetch=1
audit.service.url=http://localhost
audit.service.port=8082
audit.service.create.path=/v1/audit
#Consumer Service port
server.port=8082
spring.rabbitmq.host=localhost
spring.rabbitmq.username=test
spring.rabbitmq.password=test
# Data source configurations applied for oracle
---
spring.config.activate.on-profile=oracle
spring.datasource.username=admin
spring.datasource.password=password
spring.datasource.url=jdbc:oracle:thin:@//localhost:1521/orcl
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.jpa.properties.hibernate.default_schema=itcc
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.OracleDialect 
---
spring.profiles.active=oracle

# For oauth2

spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

#Queue
zephyr.queue.name=ze_queue
zephyr.queue.exchange=ze_exchange
zephyr.queue.routing.key=ze_routing_key
spring.rabbitmq.listener.simple.prefetch=1
# Audit service configurations
audit.service.baseUrl=http://localhost:8083
# Zephyr service configurations
zephyr.service.baseUrl=http://localhost:8080
# webhook service url --> must needs to pass as vm argument
zephyr.rabbitmq.webhook.baseUrl=http://localhost:8081/webhook
# Jira retry callback configurations
# BackOffDelay allows dynamic calculation of the delay between retry attempts in millisecond
zephyr.jiracall.retry.backOffDelay=500
# multiplier allows dynamic calculation of the multiplier factor for exponential backoff
zephyr.jiracall.retry.multiplier=2
# maxAttempts specifies the maximum number of retry attempts for the jira call.
zephyr.jiracall.retry.maxAttempts=1

Notice

  • Make sure port 8082 is available.

  • zeRabbitMQConsumer should be able to connect with RabbitMQ.

  • zeRabbitMQConsumer should be able to connect to the Database of Zephyr.

Start the ze-jira-webhook with docker with the following command:

  • Navigate to zephyrservice and run the below command:

    docker-compose up -d

Verification in the browser:

Verify webhook application status by using http://<hostname>:8082/actuator/health.

Post Deployment verification on RabbitMq

  • Once your webhook and consumer jar are up ze_queue,ze_exchange, and ze_routing_key will be created as mentioned in the properties file.

  • In the Management UI, you can verify.

    → "ze_queue" with type as "quorum" will be created in the Queues and Streams tab

    add-a-new-queue.png

    → "ze_exchange" with type as "topic" will be created in the Exchanges tab

    exchange-tab.png

    → Click on the "ze_exchange” → queue name as “ze_queue“ and Routing key as “ze_routing_key“ will be created in Bindings.

    bindings.png
Publication date: