This service will...
- Read batches from NATS Jetstream Server Consumer "ENCRYPTED_BATCHES and send the appropriate ACK to the Jetstream Server
- Send HL7 batches to the HL7 Batch Receiver in the Cloud via Rest API call including tenantId and timezone of where the gateway is deployed (in configuration) in the header.
gradle tasks # will list all the available tasks
gradle build # will setup virtualenv, run all tests, and create reports and distributionUpdate gradle.properties as needed.
You can find the instructions for the NATS Jetstream server (via docker) here: https://hub.docker.com/_/nats/
You can find the instructions for the NATS Cli here: https://github.com/nats-io/natscli
Create the HL7 stream:
nats str add HL7 --subjects "HL7.*" --ack --max-msgs=-1 --max-bytes=-1 --max-age=1y --storage file --retention limits --max-msg-size=-1 --discard=old --dupe-window=2m --replicas=1Create the ENCRYPTED_BATCHES consumer for the HL7 stream:
nats con add HL7 ENCRYPTED_BATCHES --filter HL7.ENCRYPTED_BATCHES --ack explicit --pull --deliver all --max-deliver=-1 --sample 100 --replay=instant --wait=1sUse gradle to do a clean build.
nats con add HL7 ENCRYPTED_BATCHES --filter HL7.ENCRYPTED_BATCHES --ack explicit --pull --deliver all --max-deliver=-1 --sample 100 --replay=instant --max-pending=1To run unittest, execute:
gradle clean test -b local.build.gradleTo run the program, execute:
python3 -m batch_sender.mainTo send a message:
nats req HL7.ENCRYPTED_BATCHES <subject> [<body>]To send a message from a file:
echo <filename> | nats req HL7.ENCRYPTED_BATCHES <subject>You will need to override these if you are not running locally.
NATS_INCOMING_SUBJECT = NATS subject to use
NATS_SERVER_URL = NATS Jetstream connection info
BATCH_RECEIVER_URL = Batch receiver cloud URL
GATEWAY_TIMEZONE = Timezone
GATEWAY_TENANT = Tenant
Create the container using the docker build command below. Add your artifactory id (this is likely your w3 email) and key where specified.
docker build -t gateway-batch-sender:1.0.0 .If the steps completed successfully, the image specified by the -t option should now exist.
Note that the versions may need updated in the examples below.
docker run --name gateway-batch-sender -p 5000:5000 gateway-batch-sender:1.0.0