I have a scenario where I receive a Purchase Order named as PO_.xml where ID is a unique identifier contained within the message. I need to send back POCAN_.xml or POACK_.xml through the same send port where ID is the same ID I received with the original PO. I could use a dynamic port to achieve this but I want to be able to define my transfer type at run time through a binding file. I also want to be able to support numerous transfer methods without changing any code.
The solution overwrite the %SourceFileName% macro.
Within a construct message block inside the orchestration use something like the following:
Message_2 = Message_1;
Message_2(FILE.ReceivedFileName) = ”POCAN_”+System.Convert.ToString(Message_1.id);
And then when you are defining the send port use File Name: %SourceFileName%.xml
VOLA
When is %SourceFileName% actually populated with the source file name?
- %SourceFileName% is only populated when the File adapter is used to read in the message (FILE.ReceivedFileName).
- If a message was received on an adapter other than the File adapter, and it's value isn't overwritten as described above; the macro will not be substituted and will remain in the file name as is (for example, C:\Drop\%SourceFileName%).
** Added 10th Nov 2004 **
As an alternative Peter Himschoot has written the “Baptizer“ pipeline component to acheive this task take a look at "http://blog.u2u.info/DottextWeb/peter/archive/2004/11/09/319.aspx"