Skip to content

blueflood debug using intellij

Ryan Stewart edited this page Jun 14, 2022 · 3 revisions

Run Cassandra and Elasticsearch using docker-compose

Comment out "blueflood" service in the ~/blueflood/contrib/blueflood-docker-compose/docker-compose.yml file. This action will make sure that you are running only Cassandra and Elasticsearch using docker containers. Blueflood will not run. The sole purpose for doing this is to make sure you use docker containers for Cassandra and Elasticsearch while you are debugging Blueflood code using IntelliJ.

This script contains the starter of the blueflood services: ~/blueflood/bin/blueflood-start.sh

Make sure, you have maven installed. If you don't have maven installed, install it using brew install maven

  • Change directory to ~/blueflood
  • Build the dependency jar file run mvn clean package (this will build the dependency jar file blueflood-all-2.1.0-SNAPSHOT-jar-with-dependencies.jar in the folder ~/blueflood/blueflood-all/target/)

NOTE: If you want to simply run the services, then run - "bin/blueflood-start.sh"

To debug it through IntelliJ

  • Open blueflood project in IntelliJ
  • Go to file ~/blueflood/blueflood-core/src/main/java/com/rackspacecloud/blueflood/service/BluefloodServiceStarter.java You will see main method which is the starting point of the services. NOTE: I am not sure if it will work, but somebody please validate. Right click on main method and click "Debug 'BluefloodServi...main()'". I am pretty sure, this will fail, however this will create "BluefloodServiceStarter" config in the drop-down menu. Now, click "Edit Configurations..."

In Configuration window, make sure following entries are there

RunDebugConfigurations

Field "Main class:"

Make sure value is com.rackspacecloud.blueflood.service.BluefloodServiceStarter

Field "VM options:"

VM Options Make sure value is -Dblueflood.config=file:////Users/mrit1806/workspace/blueflood/demo/local/config/blueflood.conf -Dlog4j.configuration=file:////Users/mrit1806/workspace/blueflood/demo/local/config/blueflood-log4j.properties -Xms1G -Xmx1G -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=9180

NOTE: Please replace above this path (/Users/mrit1806/workspace) with your corresponding path.

Change in Project Structure...

Project Structure Settings Project Settings Libraries Libraries Select Blueflood Core

  • Click "File -> Project Structure..." to open Project configuration window
  • Go to Libraries
  • Click "+" and then select "Java"
  • Select the file ~/blueflood/blueflood-all/target/blueflood-all-2.1.0-SNAPSHOT-jar-with-dependencies.jar
  • Select "blueflood-core" in "Choose Modules" window
  • Click OK to add the dependency jar file
  • Click OK again to close the "Project configuration" window

Once "Project Structure..." window is done, you can click "debug" button to debug the code.

Using Postman rest client to send request

Postman

  • HTTP Method: POST
  • Url: http://localhost:19000/v2.0/100/ingest
  • Header: [{"key":"Content-Type","value":"application/json","description":""}]
  • Body: [ { "collectionTime": 1511847675000, "ttlInSeconds": 172800, "metricValue": 66, "metricName": "example.metric.one" }, { "collectionTime": 1511847685000, "ttlInSeconds": 172800, "metricValue": 69, "metricName": "example.metric.one" } ]
Clone this wiki locally