Reputation: 1792
I'm using this hapi-fhir v4.2.0 server with jpa and it's working just fine. I have added a few patients and I'm able to GET/POST requests to my hapi-fhir localhost environment.
I'm also able to create a subscription using this URL: http://localhost:8080/hapi-fhir-jpaserver/fhir/Subscription with this body:
{
"resourceType": "Subscription",
"criteria": "Patient",
"reason": "Give me the patient",
"end": "2021-01-01T00:00:00Z",
"status": "requested",
"channel": {
"type": "rest-hook",
"endpoint": "http://localhost:1337",
"payload": "application/json"
}
}
Whenever I made a POST or PUT to a Patient
, the subscription should be triggered and send a POST request to http://localhost:1337
but nothing happens.
What I have tried:
requested
to active
Patient
to Patient?name=John
payload
argumentapplication/fhir+json
And still not working :( what I'm missing here guys?
Edit: My backend is a simple nodejs running with morgan
, so it will log every POST/GET/PUT attempt in the console.
Upvotes: 6
Views: 2359
Reputation: 425
In response to @nirojshrestha019, I managed to run it locally via docker compose
in version v.2.0.0-rc.1
.
docker-compose.yml
version: "3.9"
services:
hapi-fhir:
image: hapiproject/hapi:v5.2.1
ports:
- target: 8080
published: 8080
x-aws-protocol: http
env_file:
- .env.dev
environment:
profiles.active: r4
spring.datasource.driverClassName: org.postgresql.Driver
deploy:
x-aws-autoscaling:
min: 1
max: 10 # required
cpu: 75
resources:
limits:
cpus: '2'
memory: 4Gb
## Uncomment these lines when working on development environment
# depends_on:
# - db
# db:
# image: postgres:13.2-alpine
# env_file:
# - .env.dev
# volumes:
# - db:/var/lib/postgresql/data
# ports:
# - 5432:5432
# volumes:
# db:
.env.dev
POSTGRES_PASSWORD
POSTGRES_USER=
POSTGRES_DB=
POSTGRES_PORT=
POSTGRES_HOST=
SPRING_DATASOURCE_URL=jdbc:postgresql://${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
SPRING_DATASOURCE_USERNAME=${POSTGRES_USER}
SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD}
HAPI_FHIR_SERVER_ADDRESS=
HAPI_FHIR_TESTER_HOME_SERVER_ADDRESS=
HAPI_FHIR_SUBSCRIPTION_RESTHOOK_ENABLED=
HAPI_FHIR_CORS_ALLOWED_ORIGIN=
Upvotes: 2
Reputation: 425
I also experienced the same thing. But, I managed to solve it.
We need to turn on the subscription rest webhook at hapi.properties file.
...
##################################################
# Subscriptions
##################################################
# Enable REST Hook Subscription Channel
subscription.resthook.enabled=true
...
If you are now using the latest version, v5.3.0, it is in application.yaml.
...
subscription:
resthook_enabled: true
...
Upvotes: 8