none
Batching based on recived file in BizTalk 2010 RRS feed

  • Question

  • I have a really simple scanario.

    1. I recieve Flat Files from an IBM mainframe
    2. I map these to  edifact (IFTMIN)
    3. IFTMIN messages is sendt to a receiver party using simple port filtering ( actually apply the map on the sendport, but that can ofcourse be changed)

     

    But, the flatfiles I receive often contains multiple lines, resulting in multiple messages in BizTalk and thus multiple Edifact messages beeing sent to partners. I need to batch all messages from one received file into a single edifact messages. This seems to me like it should be an easy task, but I have not really found a solution yet.

     

    I assume I must add batchmarker component to my flatfile pipeline, but I am a bit at a loss on how I should configure the batch settings for my partners.

    Could I in a custom plc promote EDI.BatchId(and the other EDI batch indicators and set EDI.BatchId = ReceivedFileName?

    As a release in the Batch config I could simply use a time trigger and for instance release this every 5-10 minutes(it would be plenty even, most files only contains 2-20 messages)?

     

    Any thoughts on this, or is there a better solution I could use?

    Monday, February 14, 2011 11:33 AM

Answers

  • Thank you for your contributions.

     

    I have discussed this demand with my client and they have concluded that batching based on received file is not nessecary. I have reverted to using the BatchMarker component and use a timer intervall(2 minutes) to batch messages going to different partners. This works fine.

     

    That beeing said, I can't really understand why my cusom component did not do the trick. I could se that I did indeed promote  ToBeBatched and BatchId etc, but to no avail. Oh, well, I am not going to spend any more time on it now since this is no longer a requirement from my client.

    string sEDINameSpace = "http://schemas.microsoft.com/Edi/PropertySchema";
    			 
    //Promoting EDI batch values               
    inmsg.Context.Promote("BatchId", sEDINameSpace, 1);
    inmsg.Context.Promote("ToBeBatched", sEDINameSpace, "True");
    inmsg.Context.Promote("BatchEncodingType", sEDINameSpace, "EDIFACT");
    inmsg.Context.Promote("EncodingType", sEDINameSpace, 1);
                  
    

    Friday, February 18, 2011 7:21 AM

All replies

  • Hi,

    Batch ID is created by BizTalk Server automatically when you create a Batch for the Party.

    It's not wise to set your own batch id (like RecievedFileName), as the batch id will be used by EDI Batching orchestration down the line while creating the Batch.

    I would suggest the following steps for addressing your requirement.

    • Create a Batch for the Receiving party with Batch Filter BTS.ReceivePortName == "Receive Port For Messages from Main Frame"
    • Create a custom pipeline component to promote EDI.BatchID, EDI.ToBeBatched = True and EDI.BatchEncodingType = EDIFACT.
    • Create a Receive Pipeline with XML Disassembler and place the Custom component after XML Disassembler.
    • Create a Map to map from Flat File to IFTMIN
    • In the Receive Port For Messages from Main Frame set the pipeline as the one created above and associate with the Map created.

    The message flow will be as

    Flat File -> XML Disassembler -> Custom Component -> Map (Flat File to IFTMIN)  -> BizTalk Message Box -> BizTalk EDI Batching Orchestartions - > Send port for EDIFACT Message


    Sathish - http://blog.tsathish.com - Please Indicate "Mark as Answer" if this Post has Answered the Question
    Tuesday, February 15, 2011 2:44 AM
  • Ok, most of this is already in place.

    I have a flatfile component,

    I have a map from flatfile to IFTMIN

    I have set ut a receive port which uses the flatfile dissasembler and then execs my map.

    This all works, and my(multiple) IMFTMIN output messages looks good.

    Currently I use a simple Bts.ReceivePortName filter on my send port. Should I change this, or add an extra EDI.ToBeBatched=False in order for it not to pick up messages which has not been batched?

     

    I have made a simple plc to promote these properites, but I do not seem to have any luck with this. I have put this plc after my flatfile dissassembler, so it should be executed before the map, could that be the problem? I guess context properties gets lost after creating a new message inn the map.

    Note: I have tried different versions of this and used "1" instead of 1 for BatchId, "True" instead of true on ToBeBatched etc. same result.

    string sEDINameSpace = "http://schemas.microsoft.com/Edi/PropertySchema";
                //Promoting EDI batch values               
                inmsg.Context.Promote("BatchId", sEDINameSpace, 1);
                inmsg.Context.Promote("ToBeBatched ", sEDINameSpace, true);
                inmsg.Context.Promote("DestinationPartyName", sEDINameSpace, DestinationPartyName);
                inmsg.Context.Promote("EncodingType", sEDINameSpace, 1);
    

     

    Tuesday, February 15, 2011 2:05 PM
  • Set the Send port Filter as EDI.DestinationPartyName = <PartyName>, EDI.BatchEncodingType = EDIFACT  and EDI.ToBeBatched = False

    Context Properties will be copied to the new message after the Map is executed.

    As you said, it's not working, where the message is getting suspended did you see any error message in the event viewer


    Sathish - http://blog.tsathish.com - Please Indicate "Mark as Answer" if this Post has Answered the Question
    Tuesday, February 15, 2011 2:52 PM
  • I get "No subscribers where found".

     

    I can not see any EDI properties in the Context of my suspended instances. Should they not be present? Very strange indeed. I assume I will have to triple check my plc to make absolutely sure it works ok. Should not be to hard since its about 10 lines of code except the plc "garble".

    Tuesday, February 15, 2011 3:00 PM
  • At which step the messages are suspended  is it the Batching orch or send port or the receive port ?
    Sathish - http://blog.tsathish.com - Please Indicate "Mark as Answer" if this Post has Answered the Question
    Tuesday, February 15, 2011 3:10 PM
  • Ok, I had some strange problems with my plc, but it's finally behaving itself, hehe.

     

    I have now promoted BatchId = 1 (the same as my Batch in agreement config)

    ToBeBatched = True

    BatchEncodingType = EDIFACT

     

    I have created a Batch filter which should subscribe to messages from the receive port BTS.ReceivePortName =="Receive port of flat file from Main frame" and I have added a Timer release trigger(2 minutes on my dev box).

     

    I get "Details:The published message could not be routed because no subscribers were found. This error occurs if the subscribing orchestration or send port has not been enlisted, or if some of the message properties necessary for subscription evaluation have not been promoted. Please use the Biztalk Administration console to troubleshoot this failure. ".

    It seems like the batching orchestration does not pick up my messages. If I add a simple file send port with passthru and the same filter as I have as Batch filter(BTS.ReceivePortName =="Receive port of flat file from Main frame") i get all my messages mapped to edifact xml.

     

    Batching is activated.  Any thoughts?
    Thursday, February 17, 2011 8:33 AM
  • In the "Simple File Send Port" set the filter based on EDI.BatchID = 1, EDI.ToBeBatched = True and EDI.BatchEncodingType = EDIFACT rather than BTS.ReceivePortName =="Receive port of flat file from Main frame", this to check whether the batching properties are promoted.

    Sathish - http://blog.tsathish.com - Please Indicate "Mark as Answer" if this Post has Answered the Question
    Thursday, February 17, 2011 2:30 PM
  • Hi,

    If you use any custom orchestration for mapping from flat file to Edi fact. Take a look at the following site http://biztalkwithshashikant.blogspot.com/2010/09/batching-non-edi-received-documents.html .

    1.Use direct send port in orchestration. 

    2.Use BTS.MessageType=http://targetnamespace#schemaheader in the batch filter.

    3.Use EDI.DestinationPartyName=<partyname>, EDI.ToBeBatched=False and EDI.BatchName=<batchname> in the send port filters. 

    And Dont forget to specify the send port in your party.

    ---------------------

    I consider that you are using Inbound map. If so then use something like this.

    1. Use BTS.ReceivePortName=<receiveportname> in batch filter.

    2. Use  EDI.DestinationPartyName=<partyname>, EDI.ToBeBatched=False and EDI.BatchName=<batchname> in the send port filters. 

    And Dont forget to specify the send port in your party.

    Friday, February 18, 2011 6:20 AM
  • Thank you for your contributions.

     

    I have discussed this demand with my client and they have concluded that batching based on received file is not nessecary. I have reverted to using the BatchMarker component and use a timer intervall(2 minutes) to batch messages going to different partners. This works fine.

     

    That beeing said, I can't really understand why my cusom component did not do the trick. I could se that I did indeed promote  ToBeBatched and BatchId etc, but to no avail. Oh, well, I am not going to spend any more time on it now since this is no longer a requirement from my client.

    string sEDINameSpace = "http://schemas.microsoft.com/Edi/PropertySchema";
    			 
    //Promoting EDI batch values               
    inmsg.Context.Promote("BatchId", sEDINameSpace, 1);
    inmsg.Context.Promote("ToBeBatched", sEDINameSpace, "True");
    inmsg.Context.Promote("BatchEncodingType", sEDINameSpace, "EDIFACT");
    inmsg.Context.Promote("EncodingType", sEDINameSpace, 1);
                  
    

    Friday, February 18, 2011 7:21 AM