Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1monj/969be43e5fe817c9ff6e578aac8f8123 to your computer and use it in GitHub Desktop.
Save s1monj/969be43e5fe817c9ff6e578aac8f8123 to your computer and use it in GitHub Desktop.
Mirth channel XML to send messages to Amazon SQS
<channel version="4.1.0">
<id>84a0bbfe-72dd-43ca-b9d7-d0bdfdfbf606</id>
<nextMetaDataId>5</nextMetaDataId>
<name>SQS Test</name>
<description></description>
<revision>3</revision>
<sourceConnector version="4.1.0">
<metaDataId>0</metaDataId>
<name>sourceConnector</name>
<properties class="com.mirth.connect.connectors.file.FileReceiverProperties" version="4.1.0">
<pluginProperties/>
<pollConnectorProperties version="4.1.0">
<pollingType>INTERVAL</pollingType>
<pollOnStart>true</pollOnStart>
<pollingFrequency>18000000</pollingFrequency>
<pollingHour>0</pollingHour>
<pollingMinute>0</pollingMinute>
<cronJobs/>
<pollConnectorPropertiesAdvanced>
<weekly>true</weekly>
<inactiveDays>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
</inactiveDays>
<dayOfMonth>1</dayOfMonth>
<allDay>true</allDay>
<startingHour>8</startingHour>
<startingMinute>0</startingMinute>
<endingHour>17</endingHour>
<endingMinute>0</endingMinute>
</pollConnectorPropertiesAdvanced>
</pollConnectorProperties>
<sourceConnectorProperties version="4.1.0">
<responseVariable>None</responseVariable>
<respondAfterProcessing>true</respondAfterProcessing>
<processBatch>false</processBatch>
<firstResponse>false</firstResponse>
<processingThreads>1</processingThreads>
<resourceIds class="linked-hash-map">
<entry>
<string>Default Resource</string>
<string>[Default Resource]</string>
</entry>
</resourceIds>
<queueBufferSize>1000</queueBufferSize>
</sourceConnectorProperties>
<scheme>FILE</scheme>
<host>/home/ec2-user/mirth/test/in</host>
<fileFilter>*.er7</fileFilter>
<regex>false</regex>
<directoryRecursion>false</directoryRecursion>
<ignoreDot>true</ignoreDot>
<anonymous>true</anonymous>
<username>anonymous</username>
<password>anonymous</password>
<timeout>10000</timeout>
<secure>true</secure>
<passive>true</passive>
<validateConnection>true</validateConnection>
<afterProcessingAction>DELETE</afterProcessingAction>
<moveToDirectory></moveToDirectory>
<moveToFileName></moveToFileName>
<errorReadingAction>NONE</errorReadingAction>
<errorResponseAction>AFTER_PROCESSING</errorResponseAction>
<errorMoveToDirectory></errorMoveToDirectory>
<errorMoveToFileName></errorMoveToFileName>
<checkFileAge>true</checkFileAge>
<fileAge>1000</fileAge>
<fileSizeMinimum>0</fileSizeMinimum>
<fileSizeMaximum></fileSizeMaximum>
<ignoreFileSizeMaximum>true</ignoreFileSizeMaximum>
<sortBy>date</sortBy>
<binary>false</binary>
<charsetEncoding>DEFAULT_ENCODING</charsetEncoding>
</properties>
<transformer version="4.1.0">
<elements>
<com.mirth.connect.plugins.javascriptstep.JavaScriptStep version="4.1.0">
<name>Step Send SQS</name>
<sequenceNumber>0</sequenceNumber>
<enabled>true</enabled>
<script>logger.info(&apos;== Start Source Transformer&apos;);
logger.info(&apos;- ER7 message: &apos;+msg.toString());
var jsonMsg = XmlUtil.toJson(msg.toString());
logger.info(&apos;- JSON message: &apos;+jsonMsg);
var software = Packages.software;
// Configure SQS
var sqsKey = &quot;AKI...&quot;;
var sqsSecret = &quot;...&quot;;
var sqsRegion = software.amazon.awssdk.regions.Region.US_EAST_1;
var sqsUrl = &quot;https://sqs.us-east-1.amazonaws.com/672154818234/mirth-test.fifo&quot;;
var sqsMessageGroupId = &quot;testdemo&quot;;
logger.info(&apos;- Sending SQS message to &apos;+sqsUrl);
var credentialsProvider = software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create(software.amazon.awssdk.auth.credentials.AwsBasicCredentials.create(sqsKey,sqsSecret));
var sqs = software.amazon.awssdk.services.sqs.SqsClient.builder().credentialsProvider(credentialsProvider).region(sqsRegion).build();
var sendMessageRequest = software.amazon.awssdk.services.sqs.model.SendMessageRequest;
var r = sqs.sendMessage(sendMessageRequest.builder().queueUrl(sqsUrl).messageBody(jsonMsg).messageGroupId(sqsMessageGroupId).build());
logger.info(&apos;r: &apos;+r);
logger.info(&apos;== End Source Transformer&apos;);</script>
</com.mirth.connect.plugins.javascriptstep.JavaScriptStep>
</elements>
<inboundTemplate encoding="base64"></inboundTemplate>
<outboundTemplate encoding="base64">TVNIfHx8fHx8fHx8fHx8CkVWTnx8fHx8fApQSUR8fHx8fHx8fHx8fHx8fHx8fHwKUFYxfHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHw=</outboundTemplate>
<inboundDataType>HL7V2</inboundDataType>
<outboundDataType>XML</outboundDataType>
<inboundProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2DataTypeProperties" version="4.1.0">
<serializationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2SerializationProperties" version="4.1.0">
<handleRepetitions>true</handleRepetitions>
<handleSubcomponents>true</handleSubcomponents>
<useStrictParser>false</useStrictParser>
<useStrictValidation>false</useStrictValidation>
<stripNamespaces>false</stripNamespaces>
<segmentDelimiter>\r</segmentDelimiter>
<convertLineBreaks>true</convertLineBreaks>
</serializationProperties>
<deserializationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2DeserializationProperties" version="4.1.0">
<useStrictParser>false</useStrictParser>
<useStrictValidation>false</useStrictValidation>
<segmentDelimiter>\r</segmentDelimiter>
</deserializationProperties>
<batchProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2BatchProperties" version="4.1.0">
<splitType>MSH_Segment</splitType>
<batchScript></batchScript>
</batchProperties>
<responseGenerationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2ResponseGenerationProperties" version="4.1.0">
<segmentDelimiter>\r</segmentDelimiter>
<successfulACKCode>AA</successfulACKCode>
<successfulACKMessage></successfulACKMessage>
<errorACKCode>AE</errorACKCode>
<errorACKMessage>An Error Occurred Processing Message.</errorACKMessage>
<rejectedACKCode>AR</rejectedACKCode>
<rejectedACKMessage>Message Rejected.</rejectedACKMessage>
<msh15ACKAccept>false</msh15ACKAccept>
<dateFormat>yyyyMMddHHmmss.SSS</dateFormat>
</responseGenerationProperties>
<responseValidationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2ResponseValidationProperties" version="4.1.0">
<successfulACKCode>AA,CA</successfulACKCode>
<errorACKCode>AE,CE</errorACKCode>
<rejectedACKCode>AR,CR</rejectedACKCode>
<validateMessageControlId>true</validateMessageControlId>
<originalMessageControlId>Destination_Encoded</originalMessageControlId>
<originalIdMapVariable></originalIdMapVariable>
</responseValidationProperties>
</inboundProperties>
<outboundProperties class="com.mirth.connect.plugins.datatypes.xml.XMLDataTypeProperties" version="4.1.0">
<serializationProperties class="com.mirth.connect.plugins.datatypes.xml.XMLSerializationProperties" version="4.1.0">
<stripNamespaces>false</stripNamespaces>
</serializationProperties>
<batchProperties class="com.mirth.connect.plugins.datatypes.xml.XMLBatchProperties" version="4.1.0">
<splitType>Element_Name</splitType>
<elementName></elementName>
<level>1</level>
<query></query>
<batchScript></batchScript>
</batchProperties>
</outboundProperties>
</transformer>
<filter version="4.1.0">
<elements/>
</filter>
<transportName>File Reader</transportName>
<mode>SOURCE</mode>
<enabled>true</enabled>
<waitForPrevious>true</waitForPrevious>
</sourceConnector>
<destinationConnectors>
<connector version="4.1.0">
<metaDataId>1</metaDataId>
<name>Destination Logger</name>
<properties class="com.mirth.connect.connectors.js.JavaScriptDispatcherProperties" version="4.1.0">
<pluginProperties/>
<destinationConnectorProperties version="4.1.0">
<queueEnabled>false</queueEnabled>
<sendFirst>false</sendFirst>
<retryIntervalMillis>10000</retryIntervalMillis>
<regenerateTemplate>false</regenerateTemplate>
<retryCount>0</retryCount>
<rotate>false</rotate>
<includeFilterTransformer>false</includeFilterTransformer>
<threadCount>1</threadCount>
<threadAssignmentVariable></threadAssignmentVariable>
<validateResponse>false</validateResponse>
<resourceIds class="linked-hash-map">
<entry>
<string>Default Resource</string>
<string>[Default Resource]</string>
</entry>
</resourceIds>
<queueBufferSize>1000</queueBufferSize>
<reattachAttachments>true</reattachAttachments>
</destinationConnectorProperties>
<script>logger.info(&apos;== Destination Logger&apos;);
</script>
</properties>
<transformer version="4.1.0">
<elements/>
<inboundTemplate encoding="base64"></inboundTemplate>
<outboundTemplate encoding="base64"></outboundTemplate>
<inboundDataType>XML</inboundDataType>
<outboundDataType>RAW</outboundDataType>
<inboundProperties class="com.mirth.connect.plugins.datatypes.xml.XMLDataTypeProperties" version="4.1.0">
<serializationProperties class="com.mirth.connect.plugins.datatypes.xml.XMLSerializationProperties" version="4.1.0">
<stripNamespaces>false</stripNamespaces>
</serializationProperties>
<batchProperties class="com.mirth.connect.plugins.datatypes.xml.XMLBatchProperties" version="4.1.0">
<splitType>Element_Name</splitType>
<elementName></elementName>
<level>1</level>
<query></query>
<batchScript></batchScript>
</batchProperties>
</inboundProperties>
<outboundProperties class="com.mirth.connect.plugins.datatypes.raw.RawDataTypeProperties" version="4.1.0">
<batchProperties class="com.mirth.connect.plugins.datatypes.raw.RawBatchProperties" version="4.1.0">
<splitType>JavaScript</splitType>
<batchScript></batchScript>
</batchProperties>
</outboundProperties>
</transformer>
<responseTransformer version="4.1.0">
<elements/>
<inboundTemplate encoding="base64"></inboundTemplate>
<outboundTemplate encoding="base64"></outboundTemplate>
<inboundDataType>RAW</inboundDataType>
<outboundDataType>RAW</outboundDataType>
<inboundProperties class="com.mirth.connect.plugins.datatypes.raw.RawDataTypeProperties" version="4.1.0">
<batchProperties class="com.mirth.connect.plugins.datatypes.raw.RawBatchProperties" version="4.1.0">
<splitType>JavaScript</splitType>
<batchScript></batchScript>
</batchProperties>
</inboundProperties>
<outboundProperties class="com.mirth.connect.plugins.datatypes.raw.RawDataTypeProperties" version="4.1.0">
<batchProperties class="com.mirth.connect.plugins.datatypes.raw.RawBatchProperties" version="4.1.0">
<splitType>JavaScript</splitType>
<batchScript></batchScript>
</batchProperties>
</outboundProperties>
</responseTransformer>
<filter version="4.1.0">
<elements/>
</filter>
<transportName>JavaScript Writer</transportName>
<mode>DESTINATION</mode>
<enabled>true</enabled>
<waitForPrevious>true</waitForPrevious>
</connector>
</destinationConnectors>
<preprocessingScript>// Modify the message variable below to pre process data
return message;</preprocessingScript>
<postprocessingScript>// This script executes once after a message has been processed
// Responses returned from here will be stored as &quot;Postprocessor&quot; in the response map
return;</postprocessingScript>
<deployScript>// This script executes once when the channel is deployed
// You only have access to the globalMap and globalChannelMap here to persist data
return;</deployScript>
<undeployScript>// This script executes once when the channel is undeployed
// You only have access to the globalMap and globalChannelMap here to persist data
return;</undeployScript>
<properties version="4.1.0">
<clearGlobalChannelMap>true</clearGlobalChannelMap>
<messageStorageMode>DEVELOPMENT</messageStorageMode>
<encryptData>false</encryptData>
<removeContentOnCompletion>false</removeContentOnCompletion>
<removeOnlyFilteredOnCompletion>false</removeOnlyFilteredOnCompletion>
<removeAttachmentsOnCompletion>false</removeAttachmentsOnCompletion>
<initialState>STARTED</initialState>
<storeAttachments>true</storeAttachments>
<metaDataColumns/>
<attachmentProperties version="4.1.0">
<type>None</type>
<properties/>
</attachmentProperties>
<resourceIds class="linked-hash-map">
<entry>
<string>Default Resource</string>
<string>[Default Resource]</string>
</entry>
</resourceIds>
</properties>
<exportData>
<metadata>
<enabled>true</enabled>
<lastModified>
<time>1662681381345</time>
<timezone>America/New_York</timezone>
</lastModified>
<pruningSettings>
<archiveEnabled>true</archiveEnabled>
<pruneErroredMessages>false</pruneErroredMessages>
</pruningSettings>
</metadata>
</exportData>
</channel>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment