Skip to content

Commit

Permalink
Working on modularizing worker
Browse files Browse the repository at this point in the history
  • Loading branch information
lapplislazuli committed Oct 23, 2019
1 parent d12b921 commit 4461169
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
12 changes: 4 additions & 8 deletions worker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
<artifactId>activemq-all</artifactId>
<version>5.15.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.jms/javax.jms-api -->
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0.1</version>
</dependency>
<!-- DataBase Connector -->
<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
<dependency>
Expand Down Expand Up @@ -149,6 +143,7 @@
<element>PACKAGE</element>
<excludes>
<exclude>*worker</exclude>
<exclude>*program*</exclude>
</excludes>
<limits>
<limit>
Expand All @@ -162,6 +157,7 @@
<element>CLASS</element>
<excludes>
<exclude>*Test</exclude>
<exclude>*App</exclude>
<exclude>*MariaDbWriter</exclude>
</excludes>
<limits>
Expand Down Expand Up @@ -252,7 +248,7 @@
<!-- MainClass in mainfest make a executable jar -->
<archive>
<manifest>
<mainClass>microtope.worker.App</mainClass>
<mainClass>microtope.program.App</mainClass>
</manifest>
</archive>
</configuration>
Expand All @@ -276,7 +272,7 @@
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>microtope.worker.App</mainClass>
<mainClass>microtope.program.App</mainClass>
</manifest>
</archive>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package microtope.worker;
package microtope.program;

import java.io.IOException;
import java.sql.SQLException;
Expand All @@ -8,6 +8,9 @@

import microtope.config.ActiveMqConfiguration;
import microtope.config.SqlConfig;
import microtope.worker.ActiveMqMessageReciever;
import microtope.worker.DatabaseInsertListener;
import microtope.worker.MariaDbWriter;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
2 changes: 1 addition & 1 deletion worker/src/main/java/microtope/worker/MariaDbWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void open(Connection con) throws SQLException {
healthcheck();
}

protected Connection buildConnectionFromConfig() throws SQLException {
public Connection buildConnectionFromConfig() throws SQLException {
var url = String.format("jdbc:mysql://%s:%s/%s",sqlconf.addressToConnect,sqlconf.portToConnect,sqlconf.databaseToConnect);
logger.debug("Trying to connect to " + url + " as " + sqlconf.userToConnect + " with Password [REDACTED]");
var con = DriverManager.getConnection(url, sqlconf.userToConnect, sqlconf.passwordToConnect);
Expand Down
9 changes: 9 additions & 0 deletions worker/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module worker {
requires transitive org.apache.logging.log4j;
//requires transitive org.apache.activemq;
requires java.sql;

requires activemq.all;

exports microtope.program;
}
2 changes: 2 additions & 0 deletions worker/src/test/java/microtope/worker/AppTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import org.junit.jupiter.api.Test;

import microtope.program.App;

class AppTests {

@Test
Expand Down

0 comments on commit 4461169

Please sign in to comment.