Skip to content

Commit

Permalink
Merge pull request #6 from DataINCITE/flynnc3-temp
Browse files Browse the repository at this point in the history
Stable PR For API Handler Integration and Engine Internal Rework
  • Loading branch information
flynnc3 authored Mar 21, 2023
2 parents 4ee2adc + 982b5f2 commit ee236ba
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 26 deletions.
1 change: 1 addition & 0 deletions DeFi-Data-Engine/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'Testing Environment'/
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ public Engine() {
// source: source of the local stream to initialize
public Response processSTRT(Packet packet) {
// start output processes:
//TODO: RE-ENABLE
// Response out_response = send("OUT", "STRT");
// if(out_response.code() != 200)
// return out_response;
Response out_response = send("OUT", "STRT");
if(out_response.code() != 200)
return out_response;

// start local stream handler processes:
String lsh_type = Config.getProperty("stream", "local.stream.type");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ protected boolean init() {
listener = new Thread() {
public void run() {
while(true) {
System.out.println("accepting...");
String key = SocketManager.accept(Integer.parseInt(Config.getProperty("stream", "output.socket.port")), producer);
if(key == null) {
System.err.println("SocketProducer: Could not create connection to socket port.");
System.exit(1);
}

System.out.println("accepted!");
manager.add(new SocketDestination(key, SocketManager.write(key)));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ public void run() {

// execute valid response to engine
Response response = producer.send(tag, sub_tag, data);
// out.writeUTF(new JSONObject()
// .put("response", "200")
// .put("code", response.code())
// .put("message", response.message())
// .put("data", response.data())
// .toString());
// out.flush();
out.writeUTF(new JSONObject()
.put("response", "200")
.put("code", response.code())
.put("message", response.message())
.put("data", response.data())
.toString());
out.flush();

} catch(Exception e) {
break;
Expand Down Expand Up @@ -204,9 +204,9 @@ private static boolean synced(String key) {
private static final String readLine(DataInputStream in) throws IOException {
StringBuilder out = new StringBuilder();
char c = 0;
while((c = (char)in.read()) != 10)
while((c = (char)in.read()) != 10) {
out.append(c);

}
return out.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Config {
properties.put("app", app_properties);

Properties stream_properties = new Properties();
stream_properties.put("general.consumer.types", "socket_consumer");
stream_properties.put("general.consumer.types", "null");
stream_properties.put("general.producer.types", "socket_producer");
stream_properties.put("rest.socket.address", "DataEngine");
//stream_properties.put("rest.socket.address", "localhost");
Expand All @@ -32,8 +32,8 @@ public class Config {
stream_properties.put("output.socket.port", "61200");
stream_properties.put("local.stream.type", "mongo_db");
//stream_properties.put("local.stream.type", "null");
//stream_properties.put("mongodb.properties.uri", "mongodb://MONGO:27017");
stream_properties.put("mongodb.properties.uri", "mongodb://localhost:27017");
stream_properties.put("mongodb.properties.uri", "mongodb://MONGO:27017");
//stream_properties.put("mongodb.properties.uri", "mongodb://localhost:27017");
stream_properties.put("mongodb.database.state", "main-state-db");
stream_properties.put("mongodb.database.main", "main-db");
stream_properties.put("mongodb.auth.collection", "auth-collection");
Expand Down
18 changes: 9 additions & 9 deletions DeFi-Data-Engine/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ services:
- 61100:61100
- 61200:61200
hostname: DataEngine
restapp:
build:
context: "Rest Application"
image: dataincite/data-engine-rest-app:latest
depends_on:
- dataengine
ports:
- 8080:8080
hostname: RestApp
# restapp:
# build:
# context: "Rest Application"
# image: dataincite/data-engine-rest-app:latest
# depends_on:
# - dataengine
# ports:
# - 8080:8080
# hostname: RestApp



Expand Down

0 comments on commit ee236ba

Please sign in to comment.