Processors: Cluster Manager module
Cluster Manager module is available to all other modules, so no specific dependency needs to be configured to use it.
Smile Camel broker is both a consumer and a processor, which means that it can participate in a route as a consumer <from..>
or producer <to..>
endpoint.
Example from
URI: <from uri="smile:clustermgr/broker?topic=?my-kafka-from-topic">
Description: Takes messages from indicated topic, wraps them in a Camel Exchange and sends them to the following route node.
Example to
URI: <to uri="smile:clustermgr/broker?topic=my-kafka-to-topic&messageType=ca.uhn.fhir.broker.api.RawStringMessage&payloadType=java.lang.String">
Description: Sends received Camel Exchange
message to defined Smile internal topic.
The following parameters are available for the broker processor:
IMessage
. Default is ca.uhn.fhir.broker.api.RawStringMessage
.java.lang.String
.The Smile broker allows to reference topics simply by the topic name, which allows replacing a route like the following:
<route>
<from uri="kafka:v2-in-topic?brokers=localhost:9092&sslKeystoreLocation=/path/to/keystore.jks&sslKeystorePassword=changeit&sslKeyPassword=changeit&securityProtocol=SSL" />
<to uri="smile:hl7v2/hl7v2ToFhirProcessor" />
<to uri="kafka:bundle-out-topic/brokers=localhost:9092&sslKeystoreLocation=/path/to/keystore.jks&sslKeystorePassword=changeit&sslKeyPassword=changeit&securityProtocol=SSL" />
</route>
by the simpler definition:
<route>
<from uri="smile:clustermgr/broker?topic=v2-in-topic" />
<to uri="smile:persistence/bundleProcessor" />
<to uri="smile:clustermgr/broker?topic=bundle-out-topic" />
</route>
The following example shows how to use the messageType and payloadType parameters to handle typed messages. This is particularly useful when working with transaction log messages or other structured message types:
<route id="test-transaction-log">
<from uri="smile:clustermgr/broker?topic=crd.events&messageType=ca.cdr.broker.transaction.TransactionLogMessage&payloadType=ca.cdr.api.model.json.TransactionLogEventsJson$TransactionLogEventJson"/>
<log logName="ca.cdr.camel" message="${body}" loggingLevel="INFO"/>
<to uri="bean:customProcessor"/>
</route>
In this example:
messageType
parameter specifies that we expect TransactionLogMessage
objectspayloadType
parameter specifies the structure of the payload within those messagesWhen your route begins with a Kafka consumer as the source, using manual commit mode can be useful in order to guarantee that no messages will be lost in the case of a disruption.
to
URI: <to uri="smile:clustermgr/kafkaManualCommit" />
In order to use this processor, the Kafka consumer component must include the parameters autoCommitEnable=false
and allowManualCommit=true
.
The following example shows a route with manual transaction committing.
<route>
<from uri="kafka:guaranteed-delivery-topic?brokers=localhost:9092&allowManualCommit=true&autoCommitEnable=false"/>
<to uri="smile:persistence/bundleProcessor"/>
<to uri="smile:clustermgr/kafkaManualCommit" />
</route>
The Wrap In DocumentReference Processor takes a string input (such as a CDA document, PDF, or other content) and wraps it in a FHIR DocumentReference resource. The processor encodes the input as Base64 and sets it as the DocumentReference.content.attachment.data.
<to uri="smile:clustermgr/wrapInDocumentReferenceProcessor?status=current&contentType=text/xml">
The following example shows a route that reads a CDA document from a file, wraps it in a DocumentReference resource, and stores it in a FHIR repository:
<route>
<from uri="file:input/cda?noop=true"/>
<to uri="smile:clustermgr/wrapInDocumentReferenceProcessor?status=current&contentType=text/xml&typeCode=34133-9&formatCode=urn:hl7-org:sdwg:ccda-structuredBody:2.1"/>
<to uri="smile:persistence/singleResourceProcessor"/>
</route>
You are about to leave the Smile Digital Health documentation and navigate to the Open Source HAPI-FHIR Documentation.