Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public void run() {

public void cleanUp() {
thread.interrupt();
try {
thread.join();
} catch (InterruptedException e) {
LOG.info("Failed to join thread.");
}
}

private static boolean portAvailable(int port) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.jena.vocabulary.RDF;
import org.slf4j.Logger;

import eu.knowledge.engine.reasoner.BaseRule;
import eu.knowledge.engine.reasoner.Rule;
import eu.knowledge.engine.smartconnector.api.AnswerExchangeInfo;
import eu.knowledge.engine.smartconnector.api.AnswerKnowledgeInteraction;
Expand Down Expand Up @@ -203,6 +202,16 @@ public CompletableFuture<AnswerMessage> processAskFromMessageRouter(AskMessage a
KnowledgeInteractionInfo knowledgeInteractionById = this.myKnowledgeBaseStore
.getKnowledgeInteractionById(answerKnowledgeInteractionId);

if (knowledgeInteractionById == null) {
AnswerMessage m = new AnswerMessage(anAskMsg.getToKnowledgeBase(), anAskMsg.getToKnowledgeInteraction(),
anAskMsg.getFromKnowledgeBase(), anAskMsg.getFromKnowledgeInteraction(), anAskMsg.getMessageId(),
"Received AskMessage wth unknown ToKnowledgeInteractionId");
LOG.debug("Received AskMessage with unknown ToKnowledgeInteractionId: "+anAskMsg.getToKnowledgeInteraction().toString());
CompletableFuture<AnswerMessage> f = new CompletableFuture<>();
f.complete(m);
return f;
}

AnswerKnowledgeInteraction answerKnowledgeInteraction;
answerKnowledgeInteraction = (AnswerKnowledgeInteraction) knowledgeInteractionById.getKnowledgeInteraction();

Expand Down Expand Up @@ -305,6 +314,17 @@ public CompletableFuture<ReactMessage> processPostFromMessageRouter(PostMessage
URI reactKnowledgeInteractionId = aPostMsg.getToKnowledgeInteraction();
KnowledgeInteractionInfo knowledgeInteractionById = this.myKnowledgeBaseStore
.getKnowledgeInteractionById(reactKnowledgeInteractionId);

if (knowledgeInteractionById == null) {
ReactMessage m = new ReactMessage(aPostMsg.getToKnowledgeBase(), aPostMsg.getToKnowledgeInteraction(),
aPostMsg.getFromKnowledgeBase(), aPostMsg.getFromKnowledgeInteraction(), aPostMsg.getMessageId(),
"Received PostMessage with unknown ToKnowledgeInteractionId");
LOG.debug("Received PostMessage with unknown ToKnowledgeInteractionId: "+aPostMsg.getToKnowledgeInteraction().toString());
CompletableFuture<ReactMessage> f = new CompletableFuture<>();
f.complete(m);
return f;
}

ReactKnowledgeInteraction reactKnowledgeInteraction;
reactKnowledgeInteraction = (ReactKnowledgeInteraction) knowledgeInteractionById.getKnowledgeInteraction();

Expand Down