BizTalk Server General - Atomic Scope ,non-serilizable object & send-receive shape

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > March 2005 > Atomic Scope ,non-serilizable object & send-receive shape





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 Atomic Scope ,non-serilizable object & send-receive shape
siddharthkhare@hotmail.com

2005-03-20, 7:47 am

Hi All,
Is it possible to use a non-serilizable object like xmlNode as well as
have send-receive shape in same scope.

If you try to use a xmlNode instance in a orchestration ...biztalk will


complain that orhestration is not atomic.
So you make the transaction atomic....now assuming you have send
-receive combination in same scope you would get another error.
"an atomic scope may not contain, call or compensate a service or scope
that contains both the send and the corresponding receive of a
requestresponse operation on a 'uses' port or servicelink"

i don't want to write my own serilizable xmlNode class as far as
possible.

other option is i don't use xmlNode class.But here is why i was using
it...

1)i have complex xml structure so i want to be able to store the

intermediate result(Node).Just makes logic little simple.

2)i am doing something like this..
xmlNode childNode=ParentNode.SelectSingleNode("path");

now if don't store it in intermediate node 'childNode' and keep doing
this
ParentNode.SelectSingleNode("path") everytime i need to get to the
childNode it might be a performance hit.

......Also by putting everthing in atomc shape what exactly is
happening?
will biztalk not try to rehydrate orcehstration till the end of the
atomic scope.
ANd if that is true why doesn't it let me use send-receive shape in
same scope.....It's not going to redydrate anyways?

any ideas ...how to handle this?
THanks
siddharth

McGeeky

2005-03-20, 7:47 am

How big is the message?

--
McGeeky
http://mcgeeky.blogspot.com


<siddharthkhare@hotmail.com> wrote in message
news:1111312203.160949.119730@z14g2000cwz.googlegroups.com...
> Hi All,
> Is it possible to use a non-serilizable object like xmlNode as well as
> have send-receive shape in same scope.
>
> If you try to use a xmlNode instance in a orchestration ...biztalk will
>
>
> complain that orhestration is not atomic.
> So you make the transaction atomic....now assuming you have send
> -receive combination in same scope you would get another error.
> "an atomic scope may not contain, call or compensate a service or scope
> that contains both the send and the corresponding receive of a
> requestresponse operation on a 'uses' port or servicelink"
>
> i don't want to write my own serilizable xmlNode class as far as
> possible.
>
> other option is i don't use xmlNode class.But here is why i was using
> it...
>
> 1)i have complex xml structure so i want to be able to store the
>
> intermediate result(Node).Just makes logic little simple.
>
> 2)i am doing something like this..
> xmlNode childNode=ParentNode.SelectSingleNode("path");
>
> now if don't store it in intermediate node 'childNode' and keep doing
> this
> ParentNode.SelectSingleNode("path") everytime i need to get to the
> childNode it might be a performance hit.
>
> .....Also by putting everthing in atomc shape what exactly is
> happening?
> will biztalk not try to rehydrate orcehstration till the end of the
> atomic scope.
> ANd if that is true why doesn't it let me use send-receive shape in
> same scope.....It's not going to redydrate anyways?
>
> any ideas ...how to handle this?
> THanks
> siddharth
>



siddharthkhare@hotmail.com

2005-03-20, 5:51 pm

Hi,
Thanks for the reply .
It's about 50KB in my testing.
-Siddharth

McGeeky

2005-03-20, 5:51 pm

I wouldn't worry about performance for messages 50kb in size. If they were
10mb or more then it might be a problem.

I don't know why BizTalk has the restriction on send/receive for atomic
scopes.

Why can't you put the atomic scope around the node manipulation only? What
are you trying to do with the node exactly?

--
McGeeky
http://mcgeeky.blogspot.com


<siddharthkhare@hotmail.com> wrote in message
news:1111312203.160949.119730@z14g2000cwz.googlegroups.com...
> Hi All,
> Is it possible to use a non-serilizable object like xmlNode as well as
> have send-receive shape in same scope.
>
> If you try to use a xmlNode instance in a orchestration ...biztalk will
>
>
> complain that orhestration is not atomic.
> So you make the transaction atomic....now assuming you have send
> -receive combination in same scope you would get another error.
> "an atomic scope may not contain, call or compensate a service or scope
> that contains both the send and the corresponding receive of a
> requestresponse operation on a 'uses' port or servicelink"
>
> i don't want to write my own serilizable xmlNode class as far as
> possible.
>
> other option is i don't use xmlNode class.But here is why i was using
> it...
>
> 1)i have complex xml structure so i want to be able to store the
>
> intermediate result(Node).Just makes logic little simple.
>
> 2)i am doing something like this..
> xmlNode childNode=ParentNode.SelectSingleNode("path");
>
> now if don't store it in intermediate node 'childNode' and keep doing
> this
> ParentNode.SelectSingleNode("path") everytime i need to get to the
> childNode it might be a performance hit.
>
> .....Also by putting everthing in atomc shape what exactly is
> happening?
> will biztalk not try to rehydrate orcehstration till the end of the
> atomic scope.
> ANd if that is true why doesn't it let me use send-receive shape in
> same scope.....It's not going to redydrate anyways?
>
> any ideas ...how to handle this?
> THanks
> siddharth
>



Ben Cops

2005-03-21, 7:47 am

You can't put the send and receive in the atomic scope, because the "send to
messagebox" operation hasn't actually been committed to the biztalk
messagebox database until the end of the atomic scope. Obviously this makes
it hard for the adapter to pick it up, and for the system you're sending the
message to to reply.
You're right about biztalk not dehydrating during an atomic scope though.

But what to do though. Can you find a way of encapsulating this logic into
a single, static method on a helper class? If so you can simply reference
and call this from your orchestration - bts will not try to dehydrate
mid-method call!

"McGeeky" wrote:

> I wouldn't worry about performance for messages 50kb in size. If they were
> 10mb or more then it might be a problem.
>
> I don't know why BizTalk has the restriction on send/receive for atomic
> scopes.
>
> Why can't you put the atomic scope around the node manipulation only? What
> are you trying to do with the node exactly?
>
> --
> McGeeky
> http://mcgeeky.blogspot.com
>
>
> <siddharthkhare@hotmail.com> wrote in message
> news:1111312203.160949.119730@z14g2000cwz.googlegroups.com...
>
>
>

siddharthkhare@hotmail.com

2005-03-21, 5:59 pm

Thanks for the reponse..

I know little about biztalk so i could be wrong but..

To me send and receive are part of same atomic transaction.
i don't undestand why it is implemented that way.

it should be able to send the message using send port and continue with
receive and if there is a error (rollback)...then it should roll back
(assuming you are using biztalk adapter otherwise we have to roll back
ourself).


It's like saying you can not put two sql statement one after the other
in sql transaction.
I want to execute first sql satement and get some results and use them
in second sql statement..but they have to be part of same transaction.

I undestand that the transactions in biztalk are little different but
some sometimes things like this make you do a lot of extra work for a
simple thing..

i will give you another example .

I am writing following code in a expression box.

strPaymentPlan =
((System.Xml.XmlNode)(TmpDoc.SelectSingleNode("DlqResearchs/DlqResearch/DelinquencyResearchInfo/TaxBills"))).ChildNodes[0].Attributes["PaymentStatus"].Value;

biztalk won't compile it.

only way to compile it is ..

Temp_System_Xml_XmlNode =
(System.Xml.XmlNode)(TmpDoc.SelectSingleNode("DlqResearchs/DlqResearch/DelinquencyResearchInfo/TaxBills"));

strPaymentPlan = Temp_System_Xml_XmlNode
..ChildNodes[0].Attributes["PaymentStatus"].Value

If you try to do it in one step it does not compile even though you are
explicitly casting it to System.Xml.XmlNode.
you have to take it in a temp variable of type system.xml.xmlNode and
then it will compile.

problem is i can not declare a XMlNode variable for the the reason i
mentioned in my previuos post...so now i have to write a external
assembly with satatic class for this simple task?

Thanks
siddharth

Ben Cops

2005-03-22, 7:47 am

First - remember that you are working with a huge peice of software - its a
framework, and you have to abide by its rules. In return you get a huge
amount of plumbing and services that will enable you to produce a quality
implementation.
That said, to address your specific questions
- On a conceptual level it makes sense that the send and receive not be in
the same transaction because you're sending to an external system and you
can't undo *that* as part of a tran rollback - once the system has received
the message enough to send you a response, the damage is done! The only
thing you can do is send the other system a message which manually undoes the
work. This is what compensations are for. Plus you wouldn't want to\
couldn't hold a transaction for that long (sending and receiving to an
external system may take weeks?) anyway.
- Technically, as I've said, the message doesn't actually get committed to
the messagebox until you commit the atomic scope anyway, so it can't get
picked up by the adapter and sent to the external system.

This "limitation" and the provision of the compensation mechanism recognises
that you cannot use a "transaction" when dealing with external systems or
long running processes. Instead you have long running "transactions" (sagas)
which define compensations for each unit of work so that if they complete,
they can later be undone if a subsequent action fails.

- Regarding your xmlnode question, the problem is that you can't string
these objects together using the dot notation. This is because you're
programming in xlang, not in C#, although I realise they look similar. Check
this article for a description of the differences.
http://geekswithblogs.net/cyoung/articles/3820.aspx

Essentially, remember that orchestrations are first precompiled into C#
code, and THEN compiled. The intermediate step causes all sorts of
behaviours.

Good luck!

"siddharthkhare@hotmail.com" wrote:

> Thanks for the reponse..
>
> I know little about biztalk so i could be wrong but..
>
> To me send and receive are part of same atomic transaction.
> i don't undestand why it is implemented that way.
>
> it should be able to send the message using send port and continue with
> receive and if there is a error (rollback)...then it should roll back
> (assuming you are using biztalk adapter otherwise we have to roll back
> ourself).
>
>
> It's like saying you can not put two sql statement one after the other
> in sql transaction.
> I want to execute first sql satement and get some results and use them
> in second sql statement..but they have to be part of same transaction.
>
> I undestand that the transactions in biztalk are little different but
> some sometimes things like this make you do a lot of extra work for a
> simple thing..
>
> i will give you another example .
>
> I am writing following code in a expression box.
>
> strPaymentPlan =
> ((System.Xml.XmlNode)(TmpDoc.SelectSingleNode("DlqResearchs/DlqResearch/DelinquencyResearchInfo/TaxBills"))).ChildNodes[0].Attributes["PaymentStatus"].Value;
>
> biztalk won't compile it.
>
> only way to compile it is ..
>
> Temp_System_Xml_XmlNode =
> (System.Xml.XmlNode)(TmpDoc.SelectSingleNode("DlqResearchs/DlqResearch/DelinquencyResearchInfo/TaxBills"));
>
> strPaymentPlan = Temp_System_Xml_XmlNode
> ..ChildNodes[0].Attributes["PaymentStatus"].Value
>
> If you try to do it in one step it does not compile even though you are
> explicitly casting it to System.Xml.XmlNode.
> you have to take it in a temp variable of type system.xml.xmlNode and
> then it will compile.
>
> problem is i can not declare a XMlNode variable for the the reason i
> mentioned in my previuos post...so now i have to write a external
> assembly with satatic class for this simple task?
>
> Thanks
> siddharth
>
>

Bill Ticehurst

2005-03-22, 6:03 pm

Hi Siddharth,

Dehydrating an orchestration involves persisting (serializing) all objects
within it to memory. Dehydration cannot occur while the orchestration is in
an atomic scope. Hence, if you wish to use objects that can't be persisted
then they must exist within an atomic scope (where BizTalk can't attempt to
persist them anyway).

The reason you can't have a send and receive of a request-response operation
within the same transaction is as this would break the logic. If you send a
message, the receiving end shouldn't commit (and therefore process) it until
you complete the transaction. Therefore, how can you get a response back
from a message that hasn't been committed? I hope you follow my explanation
there.

Note that although System.Xml.Document is not a serializable class, it is an
exception and can be used anywhere. If you specifically wanted to extract a
single node and store it to perform DOM operations on later, you could
create a new XmlDocument from the node and store this instead. Just an
idea; I haven't tried it and there may be more elegant solutions.

I hope this helps,

Regards,

- Bill Ticehurst [MSFT]

This posting is provided "AS IS" with no warranties, and confers no rights

<siddharthkhare@hotmail.com> wrote in message
news:1111312203.160949.119730@z14g2000cwz.googlegroups.com...
> Hi All,
> Is it possible to use a non-serilizable object like xmlNode as well as
> have send-receive shape in same scope.
>
> If you try to use a xmlNode instance in a orchestration ...biztalk will
>
>
> complain that orhestration is not atomic.
> So you make the transaction atomic....now assuming you have send
> -receive combination in same scope you would get another error.
> "an atomic scope may not contain, call or compensate a service or scope
> that contains both the send and the corresponding receive of a
> requestresponse operation on a 'uses' port or servicelink"
>
> i don't want to write my own serilizable xmlNode class as far as
> possible.
>
> other option is i don't use xmlNode class.But here is why i was using
> it...
>
> 1)i have complex xml structure so i want to be able to store the
>
> intermediate result(Node).Just makes logic little simple.
>
> 2)i am doing something like this..
> xmlNode childNode=ParentNode.SelectSingleNode("path");
>
> now if don't store it in intermediate node 'childNode' and keep doing
> this
> ParentNode.SelectSingleNode("path") everytime i need to get to the
> childNode it might be a performance hit.
>
> .....Also by putting everthing in atomc shape what exactly is
> happening?
> will biztalk not try to rehydrate orcehstration till the end of the
> atomic scope.
> ANd if that is true why doesn't it let me use send-receive shape in
> same scope.....It's not going to redydrate anyways?
>
> any ideas ...how to handle this?
> THanks
> siddharth
>



siddharthkhare@hotmail.com

2005-03-23, 6:01 pm

I Agree.
Thanks for the response.
-siddharth

siddharthkhare@hotmail.com

2005-03-26, 5:50 pm

Hi Bill,
Thanks for your reponse.
some one else emailed me another solution directly .He was not able to
post it for some reason.

========================================
==============
hey.

I saw your post one this website regarding non-serializable objects,
atomic
scopes, and send-receive ports

http://www.tech-archive.net/Archive...biztalk.general
/2005-03/0604.html

I've had a similir dilemma, and this is how I got around it *WITHOUT*
using
a freakin' .NET helper class.

I know that you can't use web service send-receive ports in an atomic
scope,
and you need atomic-scope to use non-serializable objects...it's
*ALMOST* a
classic case of catch 22 you would want to strangle the lead biztalk
developer...

anyway...as for the solution... ;-)

you need to define the orchestration with LONG-RUNNING transaction. by
default it's "no transaction." you can't use "no transaction" because
it
contain an atomic scope...

define your message types for the send and receive blah blah blah...

then define an atomic scope where you would use the non-serializable
objects
and populate your send request message inside the atomic scope (yes!
you
can!) ..........don't put the send receive ports there......well, you
can't
anyway...

at this point you can probably figure it out...the message defined in
the
global level so it's visible within the atomic scope...

I wanted to post this on the web forum but I can't figure to do
so...please
post this there...thanks.


Dexter



========================================
==================







Bill Ticehurst wrote:
> Hi Siddharth,
>
> Dehydrating an orchestration involves persisting (serializing) all

objects
> within it to memory. Dehydration cannot occur while the

orchestration is in
> an atomic scope. Hence, if you wish to use objects that can't be

persisted
> then they must exist within an atomic scope (where BizTalk can't

attempt to
> persist them anyway).
>
> The reason you can't have a send and receive of a request-response

operation
> within the same transaction is as this would break the logic. If you

send a
> message, the receiving end shouldn't commit (and therefore process)

it until
> you complete the transaction. Therefore, how can you get a response

back
> from a message that hasn't been committed? I hope you follow my

explanation
> there.
>
> Note that although System.Xml.Document is not a serializable class,

it is an
> exception and can be used anywhere. If you specifically wanted to

extract a
> single node and store it to perform DOM operations on later, you

could
> create a new XmlDocument from the node and store this instead. Just

an
> idea; I haven't tried it and there may be more elegant solutions.
>
> I hope this helps,
>
> Regards,
>
> - Bill Ticehurst [MSFT]
>
> This posting is provided "AS IS" with no warranties, and confers no

rights[vbcol=seagreen]
>
> <siddharthkhare@hotmail.com> wrote in message
> news:1111312203.160949.119730@z14g2000cwz.googlegroups.com...
as[vbcol=seagreen]
will[vbcol=seagreen]
scope[vbcol=seagreen]
using[vbcol=seagreen]
doing[vbcol=seagreen]

dalegaspi@gmail.com

2005-03-28, 7:55 am

hi. let me correct one sentence before it can cause any further
confusion:

the sentence: you can't use "no transaction" because it
contain an atomic scope...

should have read:

the sentence: you can't use "no transaction" because it *CANNOT*
contain an atomic scope...

thanks.

Dexter Legaspi

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com