Example

<< Click to Display Table of Contents >>

Navigation:  EasyDotNet documentation > Classes > TMessageQueue class >

Example

Previous pageReturn to chapter overviewNext page

Transactional Messaging

 

q       CLASS(TMessageQueue)

 

 

Example 1: All three messages will come at the same time and in the right order (nontransactional messages can get lost and/or come unraveled, e.g., first message comes the third, then comes the second, etc.).

 

q.BeginTran()

q.SendText('text 1')

q.SendText('text 2')

q.SendText('text 3')

q.CommitTran()

 

 

 

Example 2: Nothing will be sent if All_Is_OK = false.

 

q.BeginTran()

 

q.SendText('text 1')

q.SendText('text 2')

 

IF All_Is_OK

   q.SendText('text 3')

  q.CommitTran()

ELSE

  q.AbortTran()

END