Skip to content

Commit

Permalink
updating POC to remove the timer and just expose the MLLP port
Browse files Browse the repository at this point in the history
  • Loading branch information
mike4263 committed Jun 12, 2024
1 parent aa8610b commit d09425a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-hl7</artifactId>
</dependency>
<dependency>
<groupId>ca.uhn.hapi</groupId>
<artifactId>hapi-structures-v24</artifactId>
<version>2.2</version>
<!-- use the same version as your hapi-base version -->
</dependency>
<dependency>
<groupId>ca.uhn.hapi</groupId>
<artifactId>hapi-structures-v25</artifactId>
<version>2.2</version>
<!-- use the same version as your hapi-base version -->
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-xml-jaxb</artifactId>
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/com/redhat/naps/launch/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,27 @@ public void configure() throws Exception {
.handled(true)
.end() ;

/*
// produces messages to kafka
from("timer:foo?period={{timer.period}}&delay={{timer.delay}}")
.routeId("FromTimer2Kafka")
.setBody(simple(getHL7Message()))
.setHeader("origin", simple("timer"))
.to("kafka:{{kafka.topic.name}}")
.log("Message correctly sent to the topic!");
// kafka consumer
from("kafka:{{kafka.topic.name}}")
.routeId("FromKafka2MLLP")
.log("Received message from topic")
.log("Received message from topic - origin: ${header.origin}")
.to("mllp://8088")
.log("Received ACK from MLLP");
*/

from("mllp://8088?autoAck=true")
.routeId("MLLP Consumer")
.log("MLLP Received message ")
/*
.unmarshal(hl7)
.validate(messageConforms())
.bean(ProcessMessage.class, "parseMessage")
Expand All @@ -80,7 +83,8 @@ public void configure() throws Exception {
.otherwise()
.throwException(MllpInvalidMessageException.class, "Message type not supported")
.end()
.transform(ack(AcknowledgmentCode.AA))
.end();
*/
.to("log:com.redhat.naps.launch?level=DEBUG&showAll=true&multiline=true")
.to("kafka:my-topic");
}
}
3 changes: 0 additions & 3 deletions src/main/java/com/redhat/naps/launch/ProcessMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
import org.apache.camel.Exchange;

public class ProcessMessage {

@SuppressWarnings(value = "Used in Camel Route")
public Message parseMessage(Message msg, Exchange e) {
e.getIn().setHeader("queue", "ORM");
//( ( (GenericComposite) ( (Varies) ((GenericSegment) ((GenericMessage.V23) msg).structures.get("MSH").get(0).getMessage().get("MSH")).fields.get(8).get(0) ).data ).components.get(0) )

return msg;
}
}
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use Strimzi as it's power architecture compatible
quarkus.kafka.devservices.provider = strimzi

quarkus.log.category."com.redhat.naps.".level=${NAPS_LOG_LEVEL:INFO}

# Kafka topic Name
kafka.topic.name=my-topic

Expand Down

0 comments on commit d09425a

Please sign in to comment.