惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
H
Help Net Security
F
Fortinet All Blogs
MyScale Blog
MyScale Blog
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
量子位
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
AI
AI
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
U
Unit 42
V2EX - 技术
V2EX - 技术
MongoDB | Blog
MongoDB | Blog
Schneier on Security
Schneier on Security
博客园 - Franky
H
Heimdal Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
N
News | PayPal Newsroom
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网

博客园 - 成都ABC

json 反序列化,高手请进 Django Message框架尝鲜 MVC 资料推荐 杂类 资料收集 收集到的非常好的第三方控件 Silverlight 开源框架 微软企业库资料 Silverlight 收藏网站 Silverlight的依赖属性与附加属性 对MVP和MVVM的一点看法 使用BizTalk Server常见问题处理 在哪找biztalk的例子(转) 转:把自己搜集到的一些silverlight网站、第三方控件及开源代码与大家们分享(微软转载) 鸡肋: 评在IE下Siverlight3对快捷键的支持 siverlight高手解答:无法阻止silverlight把快捷键传递给IE7 WCF综合运用之:聊天系统 微软:PHP在IIS 7上雄起 - 成都ABC - 博客园 WCF学习之:实例上下文模式和并发模式的性能影响
不需要Orchestration,通过Pipeline设定动态发送端口属性
成都ABC · 2010-03-08 · via 博客园 - 成都ABC

不需要Orchestration,通过Pipeline设定动态发送端口属性

通常情况下使用动态发送端口,需要Orchestration中使用表达式(Expression)指定具体的发送端口目的地址Port_1(Microsoft.XLANGs.BaseTypes.Address) = http://www.tradingpartner.com/receive.ashx     具体的地址可以根据传入的Message通过xpath表达式或是Promote属性获取,但是每个流程只能接收制定的Schema消息,如果想做一个通用的根据消息路由就不是很方便了。

实际情况是这样,有100 不同的Schema,需要根据具体的消息实例的内容进行路由,具体的地址存放在“路由表”中,可以动态维护,一开始通过OrchestrationReciveMessage的类型定义为通用的XmlDocument处理,在流程中通过xpath获取值后再去找“路由表”中对应的地址,设定动态发送端口地址。

这样做很显然效率很差,而且不规范,容易冲突

现在可以直接通过自定义开发receivepipeline组件,在pipeline执行时把需要的地址通过属性升级(promote)方式赋值,这样动态发送端口就可以直接根据具体属性值进行发送到指定的目的地。

注意:动态发送端口只能订阅到具有promote OutboundTransportType 和OutboundTransportLocation 属性的消息,如果以上两个属性没有升级,只是通过ReceivePortName或其他属性是无法订阅到消息的。

代码:

IBaseMessageContext context = inmsg.Context;

            IBaseMessagePart bodyPart = inmsg.BodyPart;

            Stream originalStrm = bodyPart.GetOriginalDataStream();

            string inval = string.Empty;

            string outboundaddress = string.Empty;

            string[] fixstr;

            inval = Convert.ToString(context.Read(this._PropName, this._PropNamespaces));

            if (string.IsNullOrEmpty(inval))

            {

                //inval = GetInMessageValue(originalStrm);

            }

            //outboundaddress = this.GetTransportLocation(inval);

            outboundaddress = @"msmq://.\private$\mq1";

            if (outboundaddress.IndexOf("://") > 0)

            {

                fixstr = outboundaddress.Split(':');

                this._PropTransportType = fixstr[0];

                int firstidx = outboundaddress.IndexOf("//");

                outboundaddress = outboundaddress.Substring(firstidx + 2);

            }

            if (this._PropTransportType.ToLower().Trim() == "msmq")

            {

                context.Promote("Transactional", "http://schemas.microsoft.com/BizTalk/2003/msmq-properties", this._PropTransactional);

                context.Promote("TimeOut", "http://schemas.microsoft.com/BizTalk/2003/msmq-properties", 4);

                context.Promote("TimeOutUnits", "http://schemas.microsoft.com/BizTalk/2003/msmq-properties", "Days");

            }

            context.Promote("OutboundTransportType", "http://schemas.microsoft.com/BizTalk/2003/system-properties", this._PropTransportType);

            context.Promote("OutboundTransportLocation", "http://schemas.microsoft.com/BizTalk/2003/system-properties", outboundaddress);

            if (!string.IsNullOrEmpty(this._PropSPID.Trim()))

                context.Promote("SPID", "http://schemas.microsoft.com/BizTalk/2003/system-properties", this._PropSPID);

              bodyPart.Data = originalStrm;

            pc.ResourceTracker.AddResource(originalStrm);

            return inmsg;

这样做自然性能会提高很多,方便维护