So what does Msg2(*) = Msg1(*) do exactly?

A question was recently raised on the biztalkgurus.com forum, that went something along the lines of:

I’ve seen the phrase Message2(*) = Message1(*) in the ‘helper text’ for the Message Assignment shape, but I’m not too sure what it does, or how it is different from Message2 = Message1. Any ideas?

I replied to the question, albeit in haste and posted an incorrect answer, stating that Message2 = Message 1 copies only the message parts and not the context, whereas Message2(*) = Message1(*) copies everything *including* the context. I was mercilessly shot down by both Tomas Restrepo and Stephen W. Thomas for providing an incorrect answer (thanks guys!).

In an attempt to save face, I spent some time today investigating exactly what that statement does (given that there is little useful information available on the interweb). As correctly answered by Tomas and Stephen:

Message2(*) = Message1(*) copies across only the *context* of the message and nothing else. The purpose of the statement is to allow you to copy context properties to a new message that has been created using a transformation (a map) as context properties aren’t copied across in a map.

In my test scenario, I created two messages: one from a map and a second from a map plus the construct statement above, to copy across the context properties. The results can be found in the following two screenshots: standalone transformation and transformation plus context properties. As you can see, the properties have been copied across in the latter.

Its usage would be something along the following lines – in a construct message shape, the statement would appear following a transformation (‘Apply Map’) in the Message Assignment shape (‘Two(*) = One(*)’):

Message Assignment Shape - Orchestration Example UsageThe Message Assignment shape would be configured as follows: Message Assignment Shape - Expression Example UsageThis has certainly been a learning experience for me and something that I should have known, but I’m happy to admit I’m wrong. Thanks to Tomas and Stephen in showing me the error of my ways.

Advertisements

3 thoughts on “So what does Msg2(*) = Msg1(*) do exactly?

  1. It’s cool, Nick :) To be honest, I used to think that Msg1 = Msg2 would only copy the message content and not the context as well. The only reasons I knew better now was that a client had an issue with this and I had to do a bit of research to discover it copied the context as well :)

  2. Hi,

    Nice article, but I have a little problem.
    As you are doing the copy of all the context properties –> Msg_out(*) = Msg_in(*) –> you’re also doing a copy of the BTS.MessageType context property. Which means, if your Msg_out has another BTS.MessageType (which in a lot of cases is normal after a mapping or transform), it’s overwritten by the BTS.MessageType of the Msg_in.
    The Msg_out BTS.MessageType is that of the Msg_in.

    Is there a way to copy the context properties of only a given property schema? Because if you’re doing a dynamic mapping in your expression shape (orchestration), you want to copy your context properties also in a dynamic way. And not one by one (e.g.: Msg_out(BTS.contextproperty01) = Msg_in(BTS.contextproperty01) ).

    For me, it’s important that I copy all contextproperties, except the BTS.MessageType.
    This because I’m using a lot of those contextproperties in my correlationset for promotion of properties when another process/orchestration has a subscription on the message after sending it to the messagebox.
    I’m looking for a correct and simple way to do that.

    Anyone who can help?
    Thanks in advance!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s