News

My Stats

  • Posts - 28
  • Comments - 32
  • Trackbacks - 55

Twitter












Tag Cloud


Recent Comments


Recent Posts


Archives


Post Categories



Let's go over some of the out-of-the-box options for executing a pipeline from inside your orchestration.
 
It struck my mind first that the MSMQT adapter IS in fact the messagebox.
 
  1. MSMQT
 
  • Set up a schedule with 1 MSMQT send port and 1 MSMQT receive port sharing the same MSMQT queue name (for example ' loopback' would make a lot of sense)
  • Create a correlation type and set based on the my MSMQT label property.
  • Assign the MSMQT message-label to a newly created GUID inside your orchestration.
 
Try to do a send and a receive and you will see that your pipelines will be executed. As a test I could successfully parse a message from inside a schedule.
 
Another very simple option is using the HTTP adapter, credits go 100% to Scott Colestock. Scott used this as just a temporary approach to get past this problem, and then switched to the loopback adapter below...
 
  1. HTTP
 
  • Use a solicit-response send port 
  • Use bogus HTTP page that simply echoes the content back.
 
<% @ webhandler language="C#" class="LoopbackHandler" %>
using System;
using System.Web;
using System.IO;
public class LoopbackHandler : IHttpHandler
{
   public bool IsReusable
   { get { return true; } }
  
   public void ProcessRequest(HttpContext context)
   {
      using(StreamReader sr = new StreamReader(context.Request.InputStream, true))
      {
         StreamWriter sw = new StreamWriter(context.Response.OutputStream, sr.CurrentEncoding );
         sw.Write(sr.ReadToEnd());
         sw.Flush();
         sw.Close();
      }
   }
}
 
This can be easily explained because it requires no knowledge of correlation types and correlation sets, since you are using request/response ports the whole way. If simplicity is the main goal then this solution is probably superior to the MSMQT one.
 
  1. Custom LOOPBACK Adapter.
 
I also had another idea. Why not make your own loopback adapter by writing a bogus solicit-response adapter that returns a response BizTalk IBaseMessage that is a copy of the original request message. Recreate the original individual message-parts and copy of the request stream to the response stream. It's very simple - download my sample loopback adapter here.
 
  • It's a custom coded VB.NET non-batched but non-blocking (async) adapter that really doesn't do anything.
  • Uses limited memory-footprint, streams to disk. 
  • To install use the MSI package. Don't forget to add the adapter by using BizTalk administration...
  • It auto generates the transmit location URI (in fact it's a GUID). I also added a Boolean property to specify whether you want the original message and part properties to be copied on to the response-message and parts.
 
Here are some of the benefits:
 
  • Trigger pipeline execution from inside your orchestration. Just define your outbound and inbound pipelines and they will be executed.
  • Send pipeline errors can be catched by adding a deliveryfailure-exception handler. Also adapter exceptions can be catched there, but since this adapter really doesn't do anything this will be very rare (at least I hope so).
  • Receive pipeline errors can be catched by adding a general SOAP-exception handler.
  • Execute mappings from inside your orchestration by defining a map on the inbound and outbound port. When you use the later, mapping failures will be catched by the SOAP-exception handler.
  • It's a black-hole adapter if you want. It can be used to ignore the processing of certain incoming messages. Make a send-port, name it 'VANISH' and subscribe to a given message-type or receive-port name for example.
  • It's very useful for doing in-order processing. You can for example receive messages from MSMQT through a pass-through pipeline (which is recommended BTW) and process messages in-order from start-to-end while doing exception-handled parsing/validation/mapping by implementing a serial convoy.
 
Here's a sample project that demonstrates some of the benefits.
 

Remarks:
 
  • The code can definitely be improved. It has been written very quickly in the scope of a POC. Alternatively you could make a better one using the adapter base classes and the wizard. In fact I'm hoping the community will see the benefit of this loopback adapter and someone else will make a better one. I'm not (yet, ha!) a streaming and multi-threading expert.
  • Apparently it is advised to return a read-only forwarding stream to the receive-pipeline. At least until SP1 arrives. I just used the VirtualStream class from the BizTalk Streaming assembly.
  • Do not forget, and as usual: there's no warranty at all. I haven't tested this very thoroughly yet so…use the adapter at your own risk.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Comments

Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Kurt on 11/11/2004 8:34 PM
Could you not just send the message to the MsgBox via a direct port and receive it back?
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Grego on 11/12/2004 2:13 PM
I need to do some additional testing with direct ports, also with self-correlating ones. I'm not sure if direct 'messagebox' ports enable me to define the send pipeline and whether errors can be catched. I doubt if the result will be as easy to use as the HTTP or a LOOPBACK adapter...
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Kurt on 11/14/2004 11:32 PM
I checked it out and there doesn't seem to be a way to put pipelines on the direct ports.
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Grego on 11/15/2004 5:24 PM
That's what I already expected. Anyway: thank's for sharing...
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by J S on 1/27/2005 12:05 AM
any ideas on how to resolve this error:

"no service organization tree. the adapter returned a null value"

I get this error after installing the loopback adapter, and then when I try to add autogenerated items -> add adapter -> Loopback -> hit next and a dialogue box pops up with the error mentioned above.

Any ideas on how to resolve this?

Thanks in advance!

-JS
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Grego on 1/27/2005 9:39 AM
JS,

This adapter does not support generated items (since there are no schema's to be generated anyway). Why would you want to do this?

Regards,
Gregory
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by J S on 1/27/2005 7:51 PM
How would I go about using this? How can I add this to my orchestration?

a lil confused..

-JS
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Grego on 1/28/2005 2:24 PM
In the orchestration you can create a (send) port-instance of port-type "Request/Response". Create a static solicit-response (SEND) port using the BizTalk explorer with transport-adapter type LOOPBACK. Next bind your orchestration to this port. That's all pretty basic stuff...
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Hendrik Swanepoel on 10/10/2005 2:42 PM
I tried using the loopback adapter, using a flat file assembler in the send pipeline. I tested the pipeline with a send only port and it outputs the correct string.

When I try and configure the port using the loopback adapter to return a message of type string (which I thought it would be, seeing that I used the flat file assembler) it gives me an error: Received unexpected message type '' does not match expected type 'string'.

I checked the message when I do not use the flat file assembler in the send pipeline, and it then returns the correct XML.

Do you perhaps know what message tpe I should be working with?

Much appreciated.
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by DB on 10/31/2005 7:24 PM
Can an Loopback adapter be used to hack your computer?
I have ZoneAlarm Pro and I never installed a Loopback adapter but now I have one. My computer seems to behave normal. My download uploade meter shows no unusual activitie.
If I set my Loopback adapter to 'blocked' in ZoneAlarmPro is can not acces internet.

My tech-level is newbie. ;-)
I am just capable of installing XP and installing a firewall program and internet.

Thanks for replying.
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by DB on 10/31/2005 7:33 PM
From TechGuy forum. Should have browsed longer

Q: What is a loopback adapter and what does it do for a computer?

A: Loopback is used for testing or debugging problems. Loopback simply means that data sent out will be delivered back to the source (usually without actually going across a network). Either protocol software or network hardware can provide loopback, depending on what one needs to test. For example, pinging address 127.0.0.1 causes the IP software to test loopback by handing the datagram back to ICMP on the same machine.
_________________________
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by jimg on 11/8/2005 6:01 PM
hello, i am using the adapter you created. I like it. I need to verify some issues I am having with the encoding bytes on the incomming message.

Can I have your current solution please?

escuber@hotmail.com


Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by horochj on 1/30/2006 8:01 PM
Can you post your source code for the loopback adapter on this site ? or email me a copy ?

horochj@yahoo.ca

Thanks
Gravatar # Whatif i block the loopback in zalarm
Posted by sobadhy on 3/27/2006 11:23 PM
read the topic
Gravatar # Loopback dropping French Characters
Posted by horochj on 7/27/2006 1:26 PM
I've been using the loop back adpater for a while, but have noticed a problem with French characters. The send pipeline is just the standard pass through, but the receive pipeline is a schema using code page ( western european 1252 ). The document goes in with the French characters, but when the xml comes out the characters are gone. Any ideas ?
Gravatar # re: Need the source code of the adapter
Posted by Karthick on 12/22/2006 7:52 AM
Hi,
i am in need of the source code of this adapter.
My Problem line is the send port will send out a xml with a element having the flatfile data and i need that to be disaasembled in the receive side.so in the adapter i need to get the particular element value which is having the flat file data from IBaseMessage Data Stream and put that back into the IBaseMessage Data stream.

I think you can understand the issue,Please its very urgent,
Please mail me the source code at karthickg@gmail.com
or please give a URL of the source code.

Thanks and Regards,
Karthick G.
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by pandu on 4/17/2007 9:07 PM
i want to use receivefile name inside orchestration.
How can i used ?
As the file name will contain the type of operation to be done.
e.g.
EmpInsert.txt ----perform insert operation

Thanks and Regards,
Pandurang

Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by BVeldhoen on 8/7/2008 11:56 AM
Hi Gregory,

You have posted a link to the LoopbackAdapter.msi. Is it also possible to provide the source code for this loopback adapter?

Many thanks,
Bram.
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Miclas on 11/28/2008 1:09 PM
Hello,

I am using you loopback adapter. Is it possible to send me the source code for the loopback adapter, please? I am having encoding problems.

miclas.files@gmail.com

Many thanks
Miclas
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Jimit Ndiaye on 8/11/2009 12:16 PM
Not sure if this was just an addition for BTS 2009, but you can execute pipelines in BTS '09 orchestrations by adding a reference to Microsoft.Xlangs.Pipeline and doing something like:
PipelineOutput = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(YourPipeline), InputMessage);
for receive pipelines and similar for send pipelines.
Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by Anthony on 10/15/2010 12:52 PM
is there an updated version of your adapter for BTS 2009/2010?

Not sure, but it croaks when using in conjunction with custom pipeline components.

error message is very generic:

A message sent to adapter "Loopback" on send port "srExtractX12" with URI "LOOPBACK://ffa15093-f3b0-4ac7-a7f1-65b605c8a5b5" is suspended.
Error details: Microsoft.BizTalk.Component.Interop.PipelineUtil..ctor()
MessageId: {C6F84F84-B8B8-4D50-839A-19902340F824}
InstanceID: {83D755D0-A47B-45F7-90E3-60FD2D9D7E84}

Gravatar # re: Executing pipelines from inside an orchestration: Introducing the LOOPBACK adapter
Posted by harry on 10/12/2011 4:34 PM
Hi,

Could you please share the code for the custom loop back adapter. Looks like the one uploaded here is 1.1 .net framework. Thanks.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: