Correlation with nested custom activities

(beta 2.2)
I want to make a custom activity (1) that contains another custom activity (2). The innermost custom activity contains a CallExternalMethod activity that builds a message (in the MethodInvoking event), and sends this to an external application. On the ExternalDataExchange interface a "CorrelationParameter" is defined.

My outermost custom activity (1) contains as its first step my custom activity (2), because the building and sending of the messages is something I'd like to share in multiple other custom activities. The second activity is a HandleExternalEvent activity that receives the response to the CallExternalMethod activity.

The problem I am having now is that I cannot link the CallExternalMethod activity and the HandleExternalEvent activity by using a correlation token. This is because I cannot change the properties of the CallExternalMethod activity from the outermost custom activity because it displays a "locked" icon in the designer (which is logical) I want to make a correlation token on the "OwnerActivityName" of the outermost custom activity (1).

I would think the most logical way to solve this would be to somehow expose the correlation token property from custom activity 2. I have found no way to do this however. If someone knows how to do this, or knows a different possible solution, then I'd like to know how.

Here is the workflow structure displayed as a tree:

[custom activity 1]

[custom activity 2]

[CallExternalMethod activity]

[HandleExternalEvent activity]



Answer this question

Correlation with nested custom activities

  • artemuse

    Hi,

    If I understand correctly, when you are designing the Custom Activity 1 you want to set both the correlation token on the HandleExternalEvent that is hosted in Custom Activity 1 and the correlation token on the CallExternalMethodActivity hosted in Custom Activity 2 to the same value

    What if you exposed a property on Custom Activity 2, and you programatically set the correlation token of the CallExternalMethod to the value of this property.

    Then, when buidling Custom Activity 1 you would drop on an instance of Custom Activity 2 and then a HandleExternalEvent activity. Set the token on the HandleExternalEvent, and set the token property on Custom Activity 2.

    Would that give you what you need Did I understand your scenario correctly

    Thanks

    Steve


  • cyberengineer

    I had similiar problem - I think is quite difficult or impossible (I have spent a lot of time trying to work it out). I decided to put correlated CallExternalMethod and HandleExternalEvent into one custom activity and to use ParalelActivity on upper level to workaround this issue...

    I hope this helps.

    Regards,
    Marcin Kosieradzki



  • Catalin Criveteanu

    Joris,

    I am still working on this but I will get some sample code here as soon as I can.

    Thanks!

    Steve Danielson [Microsoft]
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm


  • Jamie-Home

    Thanks for the replies.

    Marcin, putting the CallExternalMethod and HandleExternalEvent in one custom activity would not solve my problem, because then I cannot re-use the CallExternalMethod with various HandleExternalEvents. But I am beginning to think this may be the only way to do this.

    Steve, you understand the problem correctly. Exposing the correlation token that way doesn't work, because the property appears "read-only" in the property editor. The property is read/write, but since my custom property on Custom Activity 2 sets the correlation token on the CallExternalMethod, this probarly does not accept the Property "Set" call.


  • ZLA

    Joris, let me try and see if I can get some sample code going for on this. I will post here once I have something (probably Monday).

    Thanks

    Steve Danielson [Microsoft]
    This posting is provided "AS IS" with no warranties, and confers no rights.


  • Correlation with nested custom activities