简体   繁体   English

延迟 Mirth 消息传递

[英]Delay Mirth message delivery

I am interfacing with a system which schedules appointments.我正在与一个安排约会的系统交互。 The destination system does not allow appointments to be scheduled more than 30 days in advance, but the source system may send the appointment at any time (frequently beyond 30 days).目标系统不允许提前 30 天以上安排约会,但源系统可以随时发送约会(通常超过 30 天)。 How can I delay the delivery of the message till it is within the 30d window?如何将消息的传递延迟到 30d window 内?

Create two channels.创建两个通道。 Have the first write the file to disk and set the "lastWriteTime" to the date you would like the message to be delivered.首先将文件写入磁盘并将“lastWriteTime”设置为您希望传递消息的日期。 The second channel should read from this directory and use the "Check File Time" option to filter only those messages with historical dates.第二个通道应该从该目录中读取并使用“检查文件时间”选项来仅过滤那些具有历史日期的消息。

Channel 1 destination 1:通道 1 目的地 1:

Transformer Javascript:变压器Javascript:

    channelMap.put('deliverAfter', msg['SCH']['SCH.11']['SCH.11.1'].toString());

Destination Settings:目的地设置:

Connector Type: Javascript Writer连接器类型:Javascript 烧录器

    var deliverAfter = DateUtil.getDate('yyyyMMddHHmm', $('deliverAfter'));
    var path = 'c:/data/queue/' + connectorMessage.getMessageId();
    org.apache.commons.io.FileUtils.writeStringToFile(new java.io.File(path), connectorMessage.getEncodedData(), 'UTF-8');
    java.nio.file.Files.setLastModifiedTime(java.nio.file.Paths.get(path), java.nio.file.attribute.FileTime.fromMillis(deliverAfter.getTime()));

Channel 2:频道 2:

Source reader settings:源阅读器设置:

Path: c:/data/queue/路径: c:/data/queue/
After Processing Action: Delete处理后操作:删除
Check File Age: Yes检查文件年龄:是
File age (ms): 1000文件年龄(毫秒):1000
Encoding: UTF-8编码:UTF-8

To avoid queuing messages to meet the delay threshold expected at the destination, I would do a JavaScript filter on the source connector of the source system to only fetch appointments that the destination considers due.为了避免排队消息以满足目的地预期的延迟阈值,我会在源系统的源连接器上执行 JavaScript 过滤器,以仅获取目的地认为到期的约会。 For further assistance, you can share a template of a source system message sample (arbitrary values not real data, I am only interested in the place holders).如需进一步帮助,您可以共享源系统消息示例的模板(任意值不是真实数据,我只对占位符感兴趣)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM