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

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

博客园 - 成都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;

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