Emeria
Emeria

Reputation: 168

Transform and Send (into two different formats) from one message

I have a file that is a report. I want to read the file into BizTalk and map the schema to another format while while parsing out any erroneous values for fields. When I parse these values, I would like to log them in a second message to be sent as an Error Output.

So I would like to:

One send message is a "cleaned" and validated copy, while the other is a message log of those erroneous values.

I was hoping that someone could help me with how I would set up the Orchestration and/or Mapping. I am not sure on how to transform the original message twice. Any help is appreciated. Thanks!

Edit: I am thinking of trying to rename the source file instead of deleting it and then reading it in again (and then deleting), having each receive transform and send a message, but I feel like there is a better way still.

Upvotes: 0

Views: 146

Answers (3)

zurebe-pieter
zurebe-pieter

Reputation: 3266

As mentioned here already: the simplest approach would be to use one receive port and two send ports. One send port for success messages, one send port for error messages.

The publish/subscribe architecture of BizTalk will be able to send one message to both send ports and as such resulting in two output files.

Another point to think about, is whether or not you would want a file if there are no success or no error results.

If there are no errors in the file, a straight scenario using two send ports, would result in an error file, but without any errors in it.

To achieve this, I would have one mapping in the receive port which maps the input format to a preprocessed format.

There, you would indicate - in a header node for example - whether or not any successful or erroneous fields were found. Promoting these properties and filtering on them in your send port would fix the above problem, since there will be nothing to subcribe to.

Upvotes: 2

DTRT
DTRT

Reputation: 11040

My first advice is to not over think it.

The simplest solution is using 2 Send Ports each with one of the two Maps you will need. Both Send Port would use the same Filter criteria and would both receive a copy of the Received Message.

Upvotes: 3

Vikas Bhardwaj
Vikas Bhardwaj

Reputation: 1510

Depending on your logic, if you can create two maps for both o/p messages, then you can use both maps in orchestration or send port. You don't need to read the same file again.

You can also create a composite schema of both o/p messages you need to create and in one map do the transformation of both as per your logic. and then have two more maps from first map o/p message to separate them out.

Upvotes: 2

Related Questions