custom pipepline

Hi

How can I promote the filename which is entered from the UI in a custom send pipeline to the %Sourcefilename% of the adapter. How can I do this?

Thanks

June 22nd, 2015 5:10pm

Normally receiving adapter sets ReceivedFileName property (e.g. FILE, FTP). If you wants to overwrite the existing value by entering in the pipeline properties and stored in to property bag, you can change these values:

By writing in context:

pInMsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", PrependData);

or promote it (if required):

pInMsg.Context.Promote("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", PrependData);

Later you can use the macro %SourceFileName% in the send adapter.
Be aware macros are case sensitive.

Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 8:16pm

Thanks

So what is the difference if I write in context or promote it. I just need the value of the filename that is entered in the UI of custom send pipeline to be available on the File adapter %SourceFileName%  on the Send port.

Also in Send pipeline in what stage should this component be used.

June 22nd, 2015 9:19pm

Hello btsserv

If you use Context.Promote then the field is identified as Promoted field and can access in the ports for filter expressions.

And if you use Context.Write then it is just writing to message context and is distinguished field which cannot be used in filter expressions in ports

Cheers

Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 10:28pm

Hi,

You need to promote the filename at your pipeline level so that you can apply the Micros used at your send port .

inmsg.Context.Promote("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", filename);

Thanks

Abhishek

June 23rd, 2015 12:57am

Thanks

In the pInMsg.Context.Promote("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", filename)

Is the second parameter the target namespace of the schema? As I am getting the below error

There was a failure executing the send pipeline: "CustomSendPipeline.Filenamepipeline, CustomSendPipeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c49f22a4f8802776" Source: "SourceFilename" Send Port: "SNP_Custompipeline" URI: "C:\New folder\%SourceFileName%.xml" Reason: Loading property information list by namespace failed or property not found in the list. Verify that the schema is deployed properly.

Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 11:47am

There was a failure executing the send pipeline: "CustomSendPipeline.Filenamepipeline, CustomSendPipeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c49f22a4f8802776" Source: "SourceFilename" Send Port: "SNP_Custompipeline" URI: "C:\New folder\%SourceFileName%.xml" Reason: Loading property information list by namespace failed or property not found in the list. Verify that the schema is deployed properly.-->
Error seems to be at send pipeline?Are you trying to promote this property on send pipeline? Why would you do that?
June 23rd, 2015 11:59am

Yes I am promoting in the send pipeline because I need to assign the FileName value entered in the UI of the custompipline to the %SourceFileName% of the file adapter.

I think I am going wrong with the code in the IBaseMessage Execute() method given below(what do I need to code in this method)

public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
        {

inmsg.Context.Promote("ReceivedFileName", "http://CustomSendPipeline.PWFileSchema", this.FileName);
            return inmsg;
        }

Thanks

Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 12:04pm

Remove .xml Just use %SourceFileName%
June 23rd, 2015 12:05pm

Hold on everyone!

You do not have to Promote FILE.ReceivedFileName to use the %SourceFileName% macro.

ReceivedFileName is simply written to the Context. You should use this code:

public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
	inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", this.FileName);
	return inmsg;
}
Also note, you must use the FILE (as in FILE.ReceivedFileName) namespace which is http://schemas.microsoft.com/BizTalk/2003/file-properties.  You cannot use a custom namespace, even if it defines ReceiveFileName, since %SourceFileName% only reads from the build in property.



Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 5:31pm

Yes I am promoting in the send pipeline because I need to assign the FileName value entered in the UI of the custompipline to the %SourceFileName% of the file adapter.

I think I am going wrong with the code in the IBaseMessage Execute() method given below(what do I need to code in this method)

public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
        {

inmsg.Context.Promote("ReceivedFileName", "http://CustomSendPipeline.PWFileSchema", this.FileName);
            return inmsg;
        }

Thanks

  • Error you mentioned above is obvious when there is no property schema like "http://CustomSendPipeline.PWFileSchema", hence you will have to use system properties defined inside  "http://schemas.microsoft.com/BizTalk/2003/file-properties".
  • It is not necessary to promote property just to access macro. In case you need it for routing etc then it is a good idea to promote it. However, it will be available for macro even if you promote it.
  • It doesn't matter whether you write in the context in receive pipeline or send pipeline because macro gets executed after pipeline does. 
  • Remember the case sensitivity for macro (as I already mentioned above)
  • Regarding the question you asked about the difference between the Context.Promote vs Context.Write, You can read details here. But in short, whether you want to write certain value to the message context as a distinguished field or to the payload as a property field. Each of these methods takes a property name, a namespace, and value. Name and namespace of the promoted properties are those defined in the property schema where as distinguished fields use a common namespace,   http://schemas.microsoft.com/BizTalk/2003/btsDistinguishedFields. I mostly promote when I need to widen the access of certain property for routing etc..
June 23rd, 2015 7:50pm

Hold on everyone!

You do not have to Promote FILE.ReceivedFileName to use the %SourceFileName% macro.

ReceivedFileName is simply written to the Context. You should use this code:

public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
	inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", this.FileName);
	return inmsg;
}
Also note, you must use the FILE (as in FILE.ReceivedFileName) namespace which is http://schemas.microsoft.com/BizTalk/2003/file-properties.  You cannot use a custom namespace, even if it defines ReceiveFileName, since %SourceFileName% only reads from the build in property.



Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 9:24pm

Hold on everyone!

You do not have to Promote FILE.ReceivedFileName to use the %SourceFileName% macro.

ReceivedFileName is simply written to the Context. You should use this code:

public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
	inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", this.FileName);
	return inmsg;
}
Also note, you must use the FILE (as in FILE.ReceivedFileName) namespace which is http://schemas.microsoft.com/BizTalk/2003/file-properties.  You cannot use a custom namespace, even if it defines ReceiveFileName, since %SourceFileName% only reads from the build in property.



June 23rd, 2015 9:24pm

Hold on everyone!

You do not have to Promote FILE.ReceivedFileName to use the %SourceFileName% macro.

ReceivedFileName is simply written to the Context. You should use this code:

public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
	inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", this.FileName);
	return inmsg;
}
Also note, you must use the FILE (as in FILE.ReceivedFileName) namespace which is http://schemas.microsoft.com/BizTalk/2003/file-properties.  You cannot use a custom namespace, even if it defines ReceiveFileName, since %SourceFileName% only reads from the build in property.



Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 9:24pm

Hold on everyone!

You do not have to Promote FILE.ReceivedFileName to use the %SourceFileName% macro.

ReceivedFileName is simply written to the Context. You should use this code:

public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
	inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", this.FileName);
	return inmsg;
}
Also note, you must use the FILE (as in FILE.ReceivedFileName) namespace which is http://schemas.microsoft.com/BizTalk/2003/file-properties.  You cannot use a custom namespace, even if it defines ReceiveFileName, since %SourceFileName% only reads from the build in property.



June 23rd, 2015 9:24pm

Hold on everyone!

You do not have to Promote FILE.ReceivedFileName to use the %SourceFileName% macro.

ReceivedFileName is simply written to the Context. You should use this code:

public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
	inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", this.FileName);
	return inmsg;
}
Also note, you must use the FILE (as in FILE.ReceivedFileName) namespace which is http://schemas.microsoft.com/BizTalk/2003/file-properties.  You cannot use a custom namespace, even if it defines ReceiveFileName, since %SourceFileName% only reads from the build in property.



Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 9:24pm

Hold on everyone!

You do not have to Promote FILE.ReceivedFileName to use the %SourceFileName% macro.

ReceivedFileName is simply written to the Context. You should use this code:

public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
	inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", this.FileName);
	return inmsg;
}
Also note, you must use the FILE (as in FILE.ReceivedFileName) namespace which is http://schemas.microsoft.com/BizTalk/2003/file-properties.  You cannot use a custom namespace, even if it defines ReceiveFileName, since %SourceFileName% only reads from the build in property.



June 23rd, 2015 9:24pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics