|
Home > Archive > BizTalk Server General > June 2005 > Custom component not always replacing the orginal message
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Custom component not always replacing the orginal message
|
|
|
| Hi all,
I've implemented a decoder pipeline component which replace the
original message with a new one.
the code is:
IBaseMessagePart bodyPart = inmsg.BodyPart;
rootElementName = "Root";
namespaceMessage = "http://name";
MemoryStream outputStream = new MemoryStream();
XmlTextWriter xmlWriter = new XmlTextWriter(outputStream,
Encoding.UTF8);
xmlWriter.WriteStartElement("ns0", rootElementName, namespaceMessage);
xmlWriter.WriteStartElement("InputFileName");
xmlWriter.WriteString("a string");
xmlWriter.WriteEndElement();
xmlWriter.WriteEndElement();
xmlWriter.Flush();
// rewind
outputStream.Seek(0, SeekOrigin.Begin);
// replace the original message
bodyPart.Data = outputStream;
pc.ResourceTracker.AddResource( outputStream );
// set the MessageType
string MessageType = namespaceMessage + "#" + rootElementName;
string systemPropertiesNamespace =
"http://schemas.microsoft.com/BizTalk/2003/system-properties";
inmsg.Context.Promote("MessageType", systemPropertiesNamespace,
messageType);
All works great if there is an orchestration for the MessageType =
namespaceMessage + "#" + rootElementName
What i dont understand is the folowing situation:
when there is no orchestration subscribed to MessageType,BTS doesn't
know how to dispatch the Message and correctly report an error.
In this case if I look in the HAT and save the message I see the
original message and not the new one wroten in
the pipeline component.
I can't understand why the original message goes in the MessageBox
and not the new one.
Can someone explain me why this occurs?
Thanks in advance, Al
| |
| Danny Buysse 2005-06-28, 7:49 am |
| This is due to the fact that BizTalk Server is suspending messages that has
no subscription. When suspending the messages are placed into the suspended
messages table within there original format, so not like they are processed
by pipelines.
Danny Buysse
http://dannybuysse.blogspot.com/
"Al" wrote:
> Hi all,
>
> I've implemented a decoder pipeline component which replace the
> original message with a new one.
> the code is:
>
> IBaseMessagePart bodyPart = inmsg.BodyPart;
>
> rootElementName = "Root";
> namespaceMessage = "http://name";
>
> MemoryStream outputStream = new MemoryStream();
>
> XmlTextWriter xmlWriter = new XmlTextWriter(outputStream,
> Encoding.UTF8);
> xmlWriter.WriteStartElement("ns0", rootElementName, namespaceMessage);
> xmlWriter.WriteStartElement("InputFileName");
> xmlWriter.WriteString("a string");
> xmlWriter.WriteEndElement();
> xmlWriter.WriteEndElement();
> xmlWriter.Flush();
>
> // rewind
> outputStream.Seek(0, SeekOrigin.Begin);
> // replace the original message
> bodyPart.Data = outputStream;
> pc.ResourceTracker.AddResource( outputStream );
> // set the MessageType
> string MessageType = namespaceMessage + "#" + rootElementName;
>
> string systemPropertiesNamespace =
> "http://schemas.microsoft.com/BizTalk/2003/system-properties";
> inmsg.Context.Promote("MessageType", systemPropertiesNamespace,
> messageType);
>
>
> All works great if there is an orchestration for the MessageType =
> namespaceMessage + "#" + rootElementName
>
> What i dont understand is the folowing situation:
> when there is no orchestration subscribed to MessageType,BTS doesn't
> know how to dispatch the Message and correctly report an error.
>
> In this case if I look in the HAT and save the message I see the
> original message and not the new one wroten in
> the pipeline component.
> I can't understand why the original message goes in the MessageBox
> and not the new one.
> Can someone explain me why this occurs?
> Thanks in advance, Al
>
| |
| news.microsoft.com 2005-06-30, 6:00 pm |
| If there is no subscriber, even for the port, let alone the source or
destination meessage then there is no subscription. Thats why you can track
messages before and after pipeline.
"Al" <al_zxcvbnm@yahoo.co.uk> wrote in message
news:f896c1a6.0506280014.1fce99c3@posting.google.com...
> Hi all,
>
> I've implemented a decoder pipeline component which replace the
> original message with a new one.
> the code is:
>
> IBaseMessagePart bodyPart = inmsg.BodyPart;
>
> rootElementName = "Root";
> namespaceMessage = "http://name";
>
> MemoryStream outputStream = new MemoryStream();
>
> XmlTextWriter xmlWriter = new XmlTextWriter(outputStream,
> Encoding.UTF8);
> xmlWriter.WriteStartElement("ns0", rootElementName, namespaceMessage);
> xmlWriter.WriteStartElement("InputFileName");
> xmlWriter.WriteString("a string");
> xmlWriter.WriteEndElement();
> xmlWriter.WriteEndElement();
> xmlWriter.Flush();
>
> // rewind
> outputStream.Seek(0, SeekOrigin.Begin);
> // replace the original message
> bodyPart.Data = outputStream;
> pc.ResourceTracker.AddResource( outputStream );
> // set the MessageType
> string MessageType = namespaceMessage + "#" + rootElementName;
>
> string systemPropertiesNamespace =
> "http://schemas.microsoft.com/BizTalk/2003/system-properties";
> inmsg.Context.Promote("MessageType", systemPropertiesNamespace,
> messageType);
>
>
> All works great if there is an orchestration for the MessageType =
> namespaceMessage + "#" + rootElementName
>
> What i dont understand is the folowing situation:
> when there is no orchestration subscribed to MessageType,BTS doesn't
> know how to dispatch the Message and correctly report an error.
>
> In this case if I look in the HAT and save the message I see the
> original message and not the new one wroten in
> the pipeline component.
> I can't understand why the original message goes in the MessageBox
> and not the new one.
> Can someone explain me why this occurs?
> Thanks in advance, Al
|
|
|
|
|