-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add healthcheck and basic docs * fix linting
- Loading branch information
Showing
4 changed files
with
88 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.net.http.HttpClient; | ||
import java.net.http.HttpRequest; | ||
import java.net.http.HttpResponse.BodyHandlers; | ||
|
||
public class HealthCheck { | ||
|
||
private static final int STATUS_OK = 200; | ||
|
||
public static void main(String[] args) | ||
throws InterruptedException, IOException { | ||
|
||
var client = HttpClient.newHttpClient(); | ||
var request = HttpRequest | ||
.newBuilder() | ||
.uri(URI.create("http://localhost:8080/actuator/health")) | ||
.header("accept", "application/json") | ||
.build(); | ||
var response = client.send(request, BodyHandlers.ofString()); | ||
if (response.statusCode() != STATUS_OK || !response | ||
.body() | ||
.contains("UP")) { | ||
throw new RuntimeException("Healthcheck failed"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# hl7-to-kafka | ||
[![MegaLinter](https://github.com/diz-unimr/hl7-to-kafka/actions/workflows/mega-linter.yml/badge.svg?branch=main)](https://github.com/diz-unimr/hl7-to-kafka/actions/workflows/mega-linter.yml?query=branch%3Amain) ![java](https://github.com/diz-unimr/hl7-to-kafka/actions/workflows/build.yml/badge.svg) ![docker](https://github.com/diz-unimr/hl7-to-kafka/actions/workflows/release.yml/badge.svg) [![codecov](https://codecov.io/gh/diz-unimr/hl7-to-kafka/graph/badge.svg?token=6vQBSuFCH3)](https://codecov.io/gh/diz-unimr/hl7-to-kafka) | ||
|
||
> HL7 v2 to Kafka producer | ||
This project consist of a HL7v2 MLLP listener, which transfers received | ||
messages to a Kafka topic. | ||
|
||
Messages are passed to a Kafka producer and send to a configured topic | ||
without any mapping. The sender receives an acknowledgement message (ACK) of | ||
each message sent. | ||
|
||
## <a name="deploy_config"></a> Configuration | ||
|
||
The following environment variables can be set: | ||
|
||
endpoint: | ||
kafka.topic: hl7-topic | ||
hl7: | ||
port: 2575 | ||
encoding: iso-8859-1 | ||
|
||
| Variable | Default | Description | | ||
|--------------------------|----------------|----------------------------------------------------------------| | ||
| BOOTSTRAP_SERVERS | localhost:9092 | Kafka brokers | | ||
| SECURITY_PROTOCOL | PLAINTEXT | Kafka communication protocol | | ||
| SSL_TRUST_STORE_PASSWORD | | Truststore password (if using `SECURITY_PROTOCOL=SSL`) | | ||
| SSL_KEY_STORE_PASSWORD | | Keystore password (if using `SECURITY_PROTOCOL=SSL`) | | ||
| SSL_TRUST_STORE_PASSWORD | | Truststore password (if using `SECURITY_PROTOCOL=SSL`) | | ||
| ENDPOINT_KAFKA_TOPIC | hl7-topic | Kafka output topic to send HL7 messages to | | ||
| ENDPOINT_HL7_PORT | 2575 | HL7 MLLP listener port | | ||
| ENDPOINT_HL7_ENCODING | iso-8859-1 | Default encoding to use if not specified in the message header | | ||
| LOG_LEVEL | info | Log level (error, warn, info, debug) | | ||
|
||
Additional application properties can be set by overriding values form the [application.yaml](src/main/resources/application.yaml) by using environment variables. | ||
|
||
## Error handling | ||
|
||
> TODO | ||
|
||
## Development | ||
|
||
A [test setup](dev/compose.yaml) and a [script](dev/send-hl7.sh) to send an example | ||
message is available for development purposes. | ||
|
||
### Builds | ||
|
||
Available image tags can be found at the [Container Registry](https://github.com/orgs/diz-unimr/packages?repo_name=hl7-to-kafka) or under | ||
[Releases](https://github.com/diz-unimr/hl7-to-kafka/releases). | ||
|
||
## License | ||
|
||
[AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.en.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters