FHIR
JVM since0.3.0 Native since0.3.0
Exchange information in the healthcare domain using the FHIR (Fast Healthcare Interoperability Resources) standard. Marshall and unmarshall FHIR objects to/from JSON. Marshall and unmarshall FHIR objects to/from XML.
What’s inside
-
FHIR component, URI syntax:
fhir:apiName/methodName
Please refer to the above links for usage and configuration details.
Maven coordinates
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-fhir</artifactId>
</dependency>
Check the User guide for more information about writing Camel Quarkus applications.
Usage
Configuring the FhirContext
in native mode
To ensure camel-quarkus-fhir
operates correctly in native mode, it is important that the FHIR component and data formats use a native mode optimized FhirContext
. Examples of how to achieve this follow below.
To use a particular FHIR version in native mode, you must ensure that it is enabled via the configuration options mentioned below. |
Endpoint configuration when using the default R4
FHIR version.
public class FhirRoutes extends RouteBuilder {
@Override
public void configure() {
from("direct:start")
.to("fhir://create/resource?fhirContext=#R4&inBody=resourceAsString");
}
}
Endpoint configuration when using a custom FHIR version (e.g R5
).
public class FhirRoutes extends RouteBuilder {
@Override
public void configure() {
from("direct:start")
.to("fhir://create/resource?fhirVersion=R5&fhirContext=#R5&inBody=resourceAsString");
}
}
Instead of setting the fhirContext
option on every endpoint URI, you can instead configure it directly on the FHIR component.
camel.component.fhir.fhir-context=#R4
FHIR data format configuration.
public class FhirRoutes extends RouteBuilder {
// Each FHIR version has a corresponding injectable named bean
@Inject
@Named("R4")
FhirContext r4FhirContext;
@Inject
@Named("R5")
FhirContext r5FhirContext;
@Override
public void configure() {
// Configure FhirJsonDataFormat with the default R4 FhirContext
FhirJsonDataFormat fhirJsonDataFormat = new FhirJsonDataFormat();
fhirJsonDataFormat.setFhirContext(r4FhirContext);
// Configure FhirXmlDataFormat with a custom version and the corresponding FhirContext
FhirXmlDataFormat fhirXmlDataFormat = new FhirXmlDataFormat();
fhirXmlDataFormat.setVersion("R5");
fhirXmlDataFormat.setFhirContext(r5FhirContext);
from("direct:marshalFhirJson")
.marshal(fhirJsonDataFormat);
from("direct:marshalFhirXml")
.marshal(fhirXmlDataFormat);
}
}
SSL in native mode
This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true
to your application.properties
yourself. See also Quarkus SSL guide.
Additional Camel Quarkus configuration
By default, only FHIR version R4
is enabled in native mode, since that is also the default version configured on the FHIR component and data formats.
Configuration property | Type | Default |
---|---|---|
Enable FHIR DSTU2 Specs in native mode. |
|
|
Enable FHIR DSTU2_HL7ORG Specs in native mode. |
|
|
Enable FHIR DSTU2_1 Specs in native mode. |
|
|
Enable FHIR DSTU3 Specs in native mode. |
|
|
Enable FHIR R4 Specs in native mode. |
|
|
Enable FHIR R5 Specs in native mode. |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.