none
BTS.MessageID is not working with new constructed message RRS feed

  • Question

  • My Orchestration is as follows:

    In expression 1 : I used the following code:

    MessageID=StudentMessage(BTS.MessageID);
    System.Diagnostics.EventLog.WriteEntry("value of MessageID in orchestration:expression shape 1",MessageID);

    In message assignment,I used the following code:

    NewStudentMessage=StudentMessage;

    In expression shape 2, I used the following code:

    MessageID=NewStudentMessage(BTS.MessageID);

    But when I put a message in receive location then I got the following error in admin cosole:

    xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'Disassembler_SingleComponent.SampleOrchestration(7ccb4ba6-69d7-1582-3d8e-b66b97961fa7)'.
    The service instance will remain suspended until administratively resumed or terminated. 
    If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
    InstanceId: 9ee2438c-b515-45d9-b1a0-b2e6559bdbf3
    Shape name: Expression_2
    ShapeId: f96a811f-ee4a-4159-a7a2-5141bea075ee
    Exception thrown from: segment 1, progress 23
    Inner exception: There is no value associated with the property 'BTS.MessageID' in the message.
            
    Exception type: MissingPropertyException
    Source: Microsoft.XLANGs.BizTalk.Engine
    Target Site: System.Object GetPropertyValueThrows(System.Type)
    The following is a stack trace that identifies the location where the exception occured

       at Microsoft.BizTalk.XLANGs.BTXEngine.BTXMessage.GetPropertyValueThrows(Type propType)
       at Disassembler_SingleComponent.SampleOrchestration.segment1(StopConditions stopOn)
       at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)

            

    Why is it occuring ?

    BTS.MessageID is not working with new constructed message ?

    Is there any other option behind this ?


    Prakash

    Monday, October 20, 2014 9:13 AM

Answers

  • InstanceId: 9ee2438c-b515-45d9-b1a0-b2e6559bdbf3
    Shape name: Expression_2
    ShapeId: f96a811f-ee4a-4159-a7a2-5141bea075ee
    Exception thrown from: segment 1, progress 23
    Inner exception: There is no value associated with the property 'BTS.MessageID' in the message.

    The Message ID is assigned ONLY on persistence (normally the send shape adds the persistence point) or during any activity that cause the Message to be published to the MessageBox.

    In your case you're trying to access it before either of the above events have occurred so you're getting a NULL. Note: You're getting the error in Expression 2

    Also it is not advisable to assign Message Id's on your own. In your scenario, the InterchangeId (or the Orchestration Instance Id) would be the same BUT Message Id's SHOULD NOT BE THE SAME.

    Regards.

    • Marked as answer by Shivay_ Monday, October 20, 2014 10:05 AM
    Monday, October 20, 2014 9:37 AM
  • BTS.MessageID gets in after the message is persisted to DB. After construction of message its not persisted. Try the message assignment in a transactional scope and then after the scope try and read the MessageID=NewStudentMessage(BTS.MessageID);


    Regards <br/> When you see answers and helpful posts,<br/> please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    • Marked as answer by Shivay_ Thursday, December 8, 2016 7:07 AM
    Monday, October 20, 2014 9:43 AM
    Answerer

All replies

  • InstanceId: 9ee2438c-b515-45d9-b1a0-b2e6559bdbf3
    Shape name: Expression_2
    ShapeId: f96a811f-ee4a-4159-a7a2-5141bea075ee
    Exception thrown from: segment 1, progress 23
    Inner exception: There is no value associated with the property 'BTS.MessageID' in the message.

    The Message ID is assigned ONLY on persistence (normally the send shape adds the persistence point) or during any activity that cause the Message to be published to the MessageBox.

    In your case you're trying to access it before either of the above events have occurred so you're getting a NULL. Note: You're getting the error in Expression 2

    Also it is not advisable to assign Message Id's on your own. In your scenario, the InterchangeId (or the Orchestration Instance Id) would be the same BUT Message Id's SHOULD NOT BE THE SAME.

    Regards.

    • Marked as answer by Shivay_ Monday, October 20, 2014 10:05 AM
    Monday, October 20, 2014 9:37 AM
  • BTS.MessageID gets in after the message is persisted to DB. After construction of message its not persisted. Try the message assignment in a transactional scope and then after the scope try and read the MessageID=NewStudentMessage(BTS.MessageID);


    Regards <br/> When you see answers and helpful posts,<br/> please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    • Marked as answer by Shivay_ Thursday, December 8, 2016 7:07 AM
    Monday, October 20, 2014 9:43 AM
    Answerer
  • Thanks Shankycheil,

    I put the 2nd expression shape after send shape and I got my output.


    Prakash

    Monday, October 20, 2014 10:06 AM
  • Hi,

    As pointed out already you are getting this error because the message doesn't get constructed until a persistence point is reached. At persistence point, the new message will get persisted to the database and get assigned all the context properties.

    To solve this you can put your Construct Message shape inside Atomic Scope. 

    Atomic shape will enforce persistence and then your Expression_2 Shape will not through this error.

    Rachit


    Monday, October 20, 2014 10:16 AM
    Moderator