问题描述
大家好,
我被困@编写自定义反汇编程序。以下是我的要求
I am stuck @ writing custom disassembler. Following is my requirement
要求:
从收到的消息批处理中,我想只选择不同的患者消息,那些具有不同患者编号的消息应该在消息框中发送。
From the received message batch, I want to select distinct patients messages only and those messages with distinct Patient number should be sent in Messagebox.
我收到什么?
批量接收以下平面文件消息
Receive following flat file message in batch
HEA | NP41 | U | 0001 | 20050623143929 | 0000514544 | NP42I0 || HCM
HEA|NP41|U|0001|20050623143929|0000514544|NP42I0||HCM
PAT | 5 ^!| Tasch ^ Irmgard ^ Frau ^!^!^!^!^ Tasch | W | 19350122 |!| DE ^ ^ ^ ^ ^!!!!!!| |!|!| DE |!^^!|!|!|!|!|!|!|!|!|!^ ^ !^ ^ ^!!!| | FAL | 101675 | 2 |||||||||||||| 20050401 | 20050630 |!|!|!|!|!|| |!|| ||!|!|!|!| !|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!| !|!|!|!|!
PAT|5^!|Tasch^Irmgard^Frau^!^!^!^!^Tasch|W|19350122|!|DE^!^!^!^!^!|!|!|!|DE|!^^!|!|!|!|!|!|!|!|!|!^!^!^!^!^!|!| FAL|101675|2||||||||||||||20050401|20050630|!|!|!|!|!||!|!||!||!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!
HEA | NP41 | U | 0001 | 20050623143929 | 0000514544 | NP42I0 || HCM
HEA|NP41|U|0001|20050623143929|0000514544|NP42I0||HCM
PAT | 6 ^ |!^塔什伊姆加德^ ^弗劳^ ^ ^ ^塔什!|!W | 19350122 |!| DE ^ ^ ^ ^ ^!!!!!!| |!|!| DE |!^^!| !|!|!|!|!|!|!|!|!^ ^ ^ ^ ^!!!!!!| | FAL | 101675 | 2 |||||||||||||| 20050401 | 20050630 |!|!|!|!|!|| |!|| ||!|!|!|!| !|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!| !|!|!|!|!
PAT|6^!|Tasch^Irmgard^Frau^!^!^!^!^Tasch|W|19350122|!|DE^!^!^!^!^!|!|!|!|DE|!^^!|!|!|!|!|!|!|!|!|!^!^!^!^!^!|!| FAL|101675|2||||||||||||||20050401|20050630|!|!|!|!|!||!|!||!||!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!
会有很多以HEA段开头的消息。
There would be many messages starting with HEA segment.
到目前为止做了什么?
我使用平面文件架构向导创建了平面文件架构,它为我创建了架构,并将记录最大值设置为无限制。
I have created flat file schema using flat file schema wizard, it created schema for me and I set record max occurrence to unbounded.
然后我创建了管道并在反汇编阶段使用平面文件反汇编程序,将文档模式设置为由平面文件模式向导创建的模式。
Then I have created pipeline and used Flat file disassembler in disassemble stage with setting document schema to be the one which was created by flat file schema wizard.
我部署了应用程序并发送了一个包含两条消息的批处理,它工作正常我最后得到两条消息。
I deployed application and sent one batch with two messages, it worked and I got finally two messages.
我在消息中收到患者数据;碰巧我会在一定时间后收到批次,其中包括同一患者的多个条目。我必须避免这种情况!
I receive patient data in the message; it happens that I would receive a batch after certain time which would include multiple entries for the same patient. I have to avoid this!
我尝试了什么?
我尝试通过扩展反汇编来创建组件,即编写自定义反汇编程序组件。在反汇编阶段,当我试图查看消息内容时,我意识到它仍然是平面文件。
I tried creating component by extending disassembler, i.e. writing custom disassembler component. In disassemble stage, when I tried to look the message contents then I realized that it is still flat file.
然后我调用了base.Disassemble(...)并想知道要转换平面文件在GetNext(...)方法中使用xml,但它不像GetNext(...)那样[此语句
而 ((disassembledMessage =
base .GetNext(pContext))!=
null )]虽然我的批次中有两条消息,但仍返回null。
Then I called base.Disassemble(…) and wondered to get the flat file converted to xml in GetNext(…) method but it wasn’t there too as GetNext(…) [This statementwhile ((disassembledMessage =base.GetNext(pContext)) != null) ] was returning null though I had two messages in my batch.
有人可以解释我吗出了什么问题以及应该怎样做才能完成我的要求?我已经阅读了很多次其他博客,其中声明GetNext(..)将被调用由Disassemble(...)生成的消息,但在这里似乎用
我的平面文件模式反汇编程序不会创建多个消息,即分裂消息。请评论
Can someone explain me please what is going wrong and what should be done to get my requirement done? I have read so many times now other blogs which states that GetNext(..) would be called for messages produced by Disassemble(…) but here it seems that with my flat file schema disassembler doesn’t creating multiple messages, i.e. splitting messages. Please comment
我的方法中的代码
public
new void 反汇编( IPipelineContext pContext,
IBaseMessage pInMsg)
{
publicnew void Disassemble(IPipelineContext pContext,IBaseMessage pInMsg) {
base 。DocumentSpecName =
this .DocumentSpecName;
base.DocumentSpecName =this.DocumentSpecName;
base 。反汇编(pContext,pInMsg);
}
public
new IBaseMessage GetNext( IPipelineContext pContext){
publicnew IBaseMessage GetNext(IPipelineContext pContext) {
IBaseMessage disassembledMessage =
null ;
IBaseMessage disassembledMessage =null;
while ((disassembledMessage =
base .GetNext(pContext))!=
null )
while ((disassembledMessage =base.GetNext(pContext)) != null)
{
{
//我选择不同记录的逻辑
}
}
}
谢谢提前!
问候,Nilesh Sarkate [记得在你的问题得到正确答复时点击"标记为已回答"]
Regards, Nilesh Sarkate [Remember to click "mark as answered" when you get a correct reply to your question]
推荐答案
由于尚未指定如何获取/传递DocumentSpecName的值。问题可能在于此部分:
base.DocumentSpecName = this.DocumentSpecName;
对于DocumentSpecName,您必须指定架构的完全限定的.NET类型名称。
这篇关于反汇编程序不会为我的Flat File Schema拆分消息,GetNext(...)方法总是返回null!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!