summaryrefslogtreecommitdiff
path: root/qpid/specs/amqp-dtx-preview.0-9.xml
blob: dd70e91d1d10a1187e455d9e1ed1922f7682a944 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
<?xml version = "1.0"?>
<!--
 -
 - Licensed to the Apache Software Foundation (ASF) under one
 - or more contributor license agreements.  See the NOTICE file
 - distributed with this work for additional information
 - regarding copyright ownership.  The ASF licenses this file
 - to you under the Apache License, Version 2.0 (the
 - "License"); you may not use this file except in compliance
 - with the License.  You may obtain a copy of the License at
 - 
 -   http://www.apache.org/licenses/LICENSE-2.0
 - 
 - Unless required by applicable law or agreed to in writing,
 - software distributed under the License is distributed on an
 - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 - KIND, either express or implied.  See the License for the
 - specific language governing permissions and limitations
 - under the License.
 -
 -->
<amqp major = "0" minor = "9" port = "5672" comment = "AMQ Protocol version 0-9">

  <!-- ==  DTX SUPPORT, 0-10 PREVIEW ========================================== -->

  
<!--
   This xml describes the dtx classes: dtxDemarcation and dtxCoordination 
   version: 1.6 by Arnaud Simon 
-->

  <!--
      ======================================================
      ==       CONSTANTS
      ======================================================
  -->

 <!-- XA constants -->

  <constant name = "xa-rbrollback" value = "1">
    <doc>
       The rollback was caused by an unspecified reason.
    </doc>
  </constant>
  <constant name = "xa-rbtimeout" value = "2">
    <doc>
      A transaction branch took too long.
    </doc>
  </constant>
  <constant name = "xa-heurhaz" value = "3">
    <doc>
      The transaction branch may have been heuristically completed.
    </doc>
  </constant>
  <constant name = "xa-heurcom" value = "4">
    <doc>
      The transaction branch has been heuristically committed.
    </doc>
  </constant>
  <constant name = "xa-heurrb" value = "5">
    <doc>
     The transaction branch has been heuristically rolled back.
    </doc>
  </constant>
  <constant name = "xa-heurmix" value = "6">
    <doc>
     The transaction branch has been heuristically committed and rolled back.
    </doc>
  </constant>
  <constant name = "xa-rdonly" value = "7">
    <doc>
     The transaction branch was read-only and has been committed. 
    </doc>
  </constant>
  <constant name = "xa-ok" value = "8">
    <doc>
     Normal execution. 
    </doc>
  </constant>

  
  <!--
      ======================================================
      ==       DOMAIN TYPES
      ======================================================
  -->

  <domain name = "Xid" type = "longstr" label = "Transaction branch identifier">
     <doc>
	An Xid uniquely identifies a transaction branch.   
    </doc>
    <rule name = "implementation">
      <doc>
        Xid contains a format identifier, two length fields and a data field: 	
	format_id  	long
	gtrid_length 	octet   
	bqual_length    octet  
	data            
        
        format_id is an implementation specific format identifier
	the data field is a sequence of octets of at most 128 bytes containing the txn id and the branch id
	gtrid_length field indicates how many bytes of this form the transaction id
	bqual_length field indicates how many bytes of this form the branch id
	The sum of the two lengths must equal the length of the data field
      </doc>      
    </rule>   
  </domain>
 
  <!-- ==  dtx-demarcation  ========================================================== -->

 
  <class name = "dtx-demarcation" handler = "channel" index = "101" label = "demarcates distributed transaction branches">
    <doc>
 	This class is part of the X-Open XA distributed transaction protocol support. It allows a channel to be 
	selected for use with distributed transactions and the transactional boundaries for work on that channel
	to be demarcated.
    </doc>
    <doc type = "grammar">
      dtx-demarcation     = C:SELECT S:SELECT-OK *demarcation

      demarcation         = C:START S:START-OK C:END S:END-OK                            
    </doc>

   
    <chassis name = "server" implement = "MAY" />
    <chassis name = "client" implement = "MAY" />

    <rule name = "access-control">
      <doc>
 	Access-tickets are propagated with XA association methods with the aim of 
	restricting which users are allowed to control which transactions. 
	The server MAY restrict transaction association to a particular identity.       
      </doc>
    </rule>   	

    <rule name = "transactionality">
      <doc>
 	Enabling XA transaction support on a channel implies that the server MUST manage transactions demarcated by start-end blocks. That is to say that on this XA-enabled channel, work undergone within transactional blocks is performed on behalf a transaction branch whereas work performed outside of transactional blocks is NOT transactional.     
      </doc>
    </rule>   	

 
    <!-- - - - SELECT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "select" synchronous = "1" index = "10" label = "select distributed transaction mode">
      <doc>
         This method sets the channel to use distributed transactions. The client must use this method at least once on a channel before using XA demarcation operations.
      </doc>
      <chassis name = "server" implement = "MAY" />
      <response name = "select-ok" />
    </method>

    <!-- - - - SELECT-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "select-ok" synchronous = "1" index = "11" label = "confirm distributed transaction mode">
      <doc>
        This method confirms to the client that the channel was successfully set to use distributed transactions.
      </doc>
      <chassis name = "client" implement = "MAY" />
    </method>

    <!-- - - START - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "start" synchronous = "1" index = "20" label = "Start a transaction branch">
      <doc>
        This method is called when messages should be produced and consumed on behalf a transaction branch identified by xid. 
      </doc>
      <chassis name = "server" implement = "MAY" />
      <response name = "start-ok" />
      <!-- rules -->
      <rule name = "commandInvalid ">
         <doc>
        If the method is invoked in an improper context (see class grammar) then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>     
	<rule name = "alreadyAssociated">
        <doc>
         If neither join nor resume is specified is specified and the transaction branch specified by xid has previously been seen then the server MUST raise a channel exception with reply code 530 (not allowed).
	 </doc>
      </rule>	
        <rule name = "joinAndresume">
         <doc>
        If join and resume are specified then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>   

      <field name = "ticket" domain = "access-ticket" label = "Access-ticket granted by the server for a specific realm">
        <doc>
          Access-ticket granted by the server for a specific realm. 
        </doc>
        <assert check = "notnull" />	
      </field>

      <field name = "xid" domain = "Xid" label = "Start any work associated with transaction branch with Xid xid">
        <doc>
          Specifies the xid of the transaction branch to be started. 
        </doc>
        <assert check = "notnull" />
	 <!-- rules -->
	<rule name = "unknownXid">
        <doc>
         If Xid is already known by the broker then the server MUST raise a channel exception with reply code 530 (not allowed).
	 </doc>
        </rule>		
      </field>

      <field name = "join" domain = "bit" label = "Indicate whether this is joining an already associated  Xid">
        <doc>    
	  Indicate that the start applies to joining a transaction previously seen. 
        </doc>	
      <!-- rules -->     
      <rule name = "unsupported">
        <doc>        
	  If the broker does not support join the server MUST raise a channel exception with reply code 540 (not implemented).
	</doc>
      </rule>
        <assert check = "notnull" />	
      </field>

      <field name = "resume" domain = "bit" label = "Indicate whether this is resuming a suspended transaction branch">
        <doc>    
	  Indicate that the start applies to resuming a suspended transaction branch specified.
        </doc>	      
        <assert check = "notnull" />	
      </field>
    </method>

     <!-- - - - START-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "start-ok" synchronous = "1" index = "21" label = "confirm distributed transaction start">
      <doc>
        This method confirms to the client that the transaction branch is started or specify the error condition. 
      </doc>
      <chassis name = "client" implement = "MAY" />
      
      <field name = "flags" domain = "short" label = "xa-ok or xa-rbrollback">
        <doc> 
         xa-ok: Normal execution. 
         xa-rbrollback: The broker marked the transaction branch rollback-only for an unspecified reason.	   
        </doc>
        <assert check = "notnull" />	
      </field>
    </method>


    <!-- - - END - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "end" synchronous = "1" index = "30" label = "End a transaction branch">
      <doc>
        This method is called when the work done on behalf a transaction branch finishes or needs to be suspended. 	
      </doc>
      <chassis name = "server" implement = "MAY" />
      <response name = "end-ok" />

      <rule name = "commandInvalid ">
         <doc>
        If the method is invoked in an improper context (see class grammar) then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>   

      <rule name = "suspendAndfail">
         <doc>
        If suspend and fail are specified then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>    
	 
      <rule name = "internalError ">
         <doc>
        If an error occurs in ending the transaction branch then the server MUST raise a channel exception with reply code 541 (internal error)
         </doc>
      </rule> 

      <rule name = "success ">
         <doc>
        If neither fail nor suspend are specified then the portion of work has completed successfully
         </doc>
      </rule> 

      <field name = "ticket" domain = "access-ticket" label = "Access-ticket granted by the server for a specific realm">
        <doc>
          Access-ticket granted by the server for a specific realm. 
        </doc>
        <assert check = "notnull" />	
      </field>

      <field name = "xid" domain = "Xid" label = "End any work associated with transaction branch with Xid xid">
        <doc>
          Specifies the xid of the transaction branch to be ended. 
        </doc>
        <assert check = "notnull" />	
	 <!-- rules -->
	<rule name = "unknownXid">
        <doc>
         If Xid is unknown (the transaction branch has not been started or has already been ended) then the server MUST raise a channel exception with reply code 404 (not found).
	 </doc>
         </rule>
      </field>

      <field name = "fail" domain = "bit" label = "Indicate whether the portion of work has failed">
        <doc>    
	  Indicates that the portion of work has failed otherwise the portion of work has completed successfully.
        </doc>	     
      <rule name = "failure">
        <doc>
         If fail is specified then the transaction should be marked as rollback-only.     
	 </doc>
      </rule>
        <assert check = "notnull" />	
      </field>

      <field name = "suspend" domain = "bit" label = "Indicate that the transaction branch is temporarily suspended in an incomplete state">
        <doc>    
	  Indicates that the transaction branch is temporarily suspended in an incomplete state. 
        </doc>	     
      <rule name = "resume">
        <doc>
         The transaction context is in a suspended state and must be resumed via the start method with resume specified.   
	 </doc>
      </rule>
        <assert check = "notnull" />	
      </field>

    </method>
   
     <!-- - - - END-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "end-ok" synchronous = "1" index = "31" label = "confirm distributed transaction end">
      <doc>
        This method confirms to the client that the transaction branch is ended or specify the error condition. 
      </doc>
      <chassis name = "client" implement = "MAY" />
      
       <field name = "flags" domain = "short" label = "xa-ok, xa-rbrollback, xa-rbtimeout">
        <doc> 
         xa-ok: Normal execution. 
         xa-rbrollback: The broker marked the transaction branch rollback-only for an unspecified reason.
	 xa-rbtimeout: The work represented by this transaction branch took too long.
        </doc>
        <assert check = "notnull" />	
      </field>
    </method> 
   </class>

 <!-- ==  dtx-coordination   ========================================================== -->


  <class name = "dtx-coordination" handler = "channel" index = "105" label = "coordinate transaction outcomes">
    <doc>
      This class is part of the X-Open XA distributed transaction protocol support. 
      It allows the transaction manager to coordinate transaction outcomes. 
    </doc>
 
    <doc type = "grammar">

      dtx-coordination    = *coordination

      coordination        =  command 
                          /  outcome
                          /  recovery

      command             = C:SET-TIMEOUT S:SET-TIMEOUT-OK
 			  / C:GET-TIMEOUT S:GET-TIMEOUT-OK
                          
      outcome             = one-phase-commit
                          / one-phase-rollback
                          / two-phase-commit
                          / two-phase-rollback

      one-phase-commit    = C:COMMIT S:COMMIT-OK

      one-phase-rollback  = C:ROLLBACK S:ROLLBACK-OK

      two-phase-commit    = C:PREPARE S:PREPARE-OK C:COMMIT S:COMMIT-OK

      two-phase-rollback  = C:PREPARE S:PREPARE-OK C:ROLLBACK S:ROLLBACK-OK

      recovery       	  = C:RECOVER S:RECOVER-OK *recovery-outcome

      recovery-outcome    = one-phase-commit
                          / one-phase-rollback
                          / C:FORGET S:FORGET-OK
    </doc>

    <chassis name = "server" implement = "MAY" />
    <chassis name = "client" implement = "MAY" />

    <rule name = "security">
      <doc>
 	Access-tickets are propagated with XA demarcation methods with the aim of 
	restricting which users are allowed to control which transactions. 
	The server MAY restrict transaction coordination to a particular identity.       
      </doc>
      <doc type = "scenario">        
      </doc>
    </rule>   	

   
    <!-- - - COMMIT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "commit" synchronous = "1" index = "10" label = "Commit the work done on behalf a transaction branch ">
      <doc>
        This method commits the work associated with xid. Any produced messages are made available and any consumed messages are discarded. 
      </doc>
      <chassis name = "server" implement = "MAY" />
      <response name = "commit-ok" />
      
      <rule name = "internalError">
         <doc>
        If an error occurs in committing the transaction branch then the server MUST raise a channel exception with reply code 541 (internal error)
         </doc>
      </rule> 

      <rule name = "commandInvalid">
         <doc>
        If the method is invoked in an improper context (see class grammar) then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>
    
      <field name = "ticket" domain = "access-ticket" label = "Access-ticket granted by the server for a specific realm">
        <doc>
          Access-ticket granted by the server for a specific realm. 
        </doc>
        <assert check = "notnull" />	
      </field>

      <field name = "xid" domain = "Xid" label = "Commit the work associated with Xid xid">
        <doc> 
          Specifies the Xid of the transaction branch to be committed. 
        </doc>
        <assert check = "notnull" />	
	 <!-- rules -->
	<rule name = "unknownXid">
        <doc>
         If Xid is unknown (the transaction branch has not been started or has already been ended) then the server MUST raise a channel exception with reply code 404 (not found).
	 </doc>
      </rule>
      <rule name = "notdisassociated">
         <doc>
        If this method is called when Xid is still associated with a channel then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>
      </field>

      <field name = "one-phase" domain = "bit" label = "Indicate that one-phase optimization must be used">
        <doc>
          When set then one-phase commit optimization is used.  
        </doc>
        <assert check = "notnull" />	
      </field>
    </method>

    <!-- - - - COMMIT-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "commit-ok" synchronous = "1" index = "11" label = "confirm distributed transaction commit">
      <doc>
        This method confirms to the client that the transaction branch is committed or specify the error condition. 
      </doc>
      <chassis name = "client" implement = "MAY" />
      
       <field name = "flags" domain = "short" label = "xa-ok, xa-heurhaz, xa-heurcom, xa-heurrb, xa-heurmix, xa-rbrollback">
        <doc> 
         xa-ok: Normal execution,
	 xa-heurhaz: Due to some failure, the work done on behalf of the specified transaction branch may have been heuristically completed.
        xa-heurcom: Due to a heuristic decision, the work done on behalf of the specified transaction
   branch was committed.
	xa-heurrb: Due to a heuristic decision, the work done on behalf of the specified transaction
   branch was rolled back.
	xa-heurmix: Due to a heuristic decision, the work done on behalf of the specified transaction
   branch was partially committed and partially rolled back.
        xa-rbrollback: The broker marked the transaction branch rollback-only for an unspecified reason.	  
	xa-rbtimeout: The work represented by this transaction branch took too long.    
        </doc>
        <assert check = "notnull" />	
      </field>
    </method>


    <!-- - - FORGET - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "forget" synchronous = "1" index = "20" label = "Discard knowledge of a heuristically-completed transaction branch">
      <doc>
        This method is called to forget about a heuristically completed transaction branch.       
      </doc>
      <chassis name = "server" implement = "MAY" />
      <response name = "forget-ok" />

      <rule name = "internalError ">
         <doc>
        If an error occurs in forgetting the transaction branch then the server MUST raise a channel exception with reply code 541 (internal error)
         </doc>
      </rule>  
      
      <rule name = "commandInvalid ">
         <doc>
        If the method is invoked in an improper context (see class grammar) then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>

      <field name = "ticket" domain = "access-ticket" label = "Access-ticket granted by the server for a specific realm">
        <doc>
          Access-ticket granted by the server for a specific realm. 
        </doc>
        <assert check = "notnull" />	
      </field>

      <field name = "xid" domain = "Xid" label = "Erase RM its knowledge of Xid xid">
        <doc> 
          Specifies the xid of the transaction branch to be forgotten. 
        </doc>
        <assert check = "notnull" />	
	 <!-- rules -->
      <rule name = "unknownXid">
        <doc>
         If Xid is unknown (the transaction branch has not been started or has already been ended) then the server MUST raise a channel exception with reply code 404 (not found).
	 </doc>
      </rule>
      <rule name = "notdisassociated">
         <doc>
        If this method is called when Xid is still associated with a channel then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>
      </field>
    </method>

    <!-- - - - FORGET-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "forget-ok" synchronous = "1" index = "21" label = "Confirm distributed transaction forget">
      <doc>
        This method confirms to the client that the transaction branch is forgotten or specify the error condition. 
      </doc>
      <chassis name = "client" implement = "MAY" />          
    </method>
 
    <!-- - - - get-Timeout - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "get-timeout" synchronous = "1" index = "30" label = "Obtain the transaction timeout value in seconds">
      <doc>
        This method obtains the current transaction timeout value in seconds. 
	If setTimeout was not used prior to invoking this method, the return value is the default timeout; otherwise, the value used in the previous setTimeout call is returned.
      </doc>
      <chassis name = "server" implement = "MAY" />
      <response name = "get-timeout-ok" />


      <field name = "xid" domain = "Xid" label = "Xid of the branch to get the timeout value">
        <doc> 
          Specifies the Xid of the transaction branch for getting the timeout.
        </doc>
        <assert check = "notnull" />	
	 <!-- rules -->
      <rule name = "unknownXid">
        <doc>
         If Xid is unknown (the transaction branch has not been started or has already been ended) then the server MUST raise a channel exception with reply code 404 (not found).
	 </doc>
      </rule>
      </field>

      <rule name = "internalError ">
         <doc>
        If an error occurs in setting the transaction timeout then the server MUST raise a channel exception with reply code 541 (internal error)
         </doc>
      </rule> 
    </method>

    <!-- - - - get-Timeout-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "get-timeout-ok" synchronous = "1" index = "31" label = "Return transaction timeout">
      <doc>
        This method returns the current transaction timeout value in seconds. 
      </doc>
      <chassis name = "client" implement = "MAY" />
      
       <field name = "timeout" domain = "long" label = "The current transaction timeout value">
        <doc> 
        The current transaction timeout value in seconds. 
        </doc>
        <assert check = "notnull" />	
      </field>
    </method>
 
    <!-- - - PREPARE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "prepare" synchronous = "1" index = "40" label = "Ask to prepare a transaction branch">
      <doc>
        This method prepares for commitment any message produced or consumed on behalf of xid. 	 
      </doc>
	
      <rule name = "internalError">
         <doc>
        If an error occurs in preparing the transaction branch then the server MUST raise a channel exception with reply code 541 (internal error). The specified Xid may or may not have been prepared.
         </doc>
      </rule> 

      <rule name = "commandInvalid">
         <doc>
        If the method is invoked in an improper context (see class grammar) then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>

      <rule name = "obligation1">
        <doc>
          Once this method successfully returns it is guaranteed that the transaction branch may be either 
	  committed or rolled back regardless of failures.
        </doc>
      </rule>

      <rule name = "obligation2">
        <doc>
          The knowledge of xid cannot be erased before commit or rollback complete the branch. 
        </doc>
      </rule>

      <chassis name = "server" implement = "MAY" />
      <response name = "prepare-ok" />

      <field name = "ticket" domain = "access-ticket" label = "Access-ticket granted by the server for a specific realm">
        <doc>
          Access-ticket granted by the server for a specific realm. 
        </doc>
        <assert check = "notnull" />	
      </field>

      <field name = "xid" domain = "Xid" label = "Prepare for commitment any work associated with Xid xid">
        <doc> 
          Specifies the Xid of the transaction branch that can be prepared.
        </doc>
        <assert check = "notnull" />	
	 <!-- rules -->
	<rule name = "unknownXid">
        <doc>
         If Xid is unknown (the transaction branch has not been started or has already been ended) then the server MUST raise a channel exception with reply code 404 (not found).
	 </doc>
        </rule>
          <rule name = "notdisassociated">
         <doc>
        If this method is called when Xid is still associated with a channel then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
        </rule>
      </field>
     </method>


    <!-- - - - PREPARE-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "prepare-ok" synchronous = "1" index = "41" label = "confirm distributed transaction prepare">
      <doc>
        This method confirms to the client that the transaction branch is prepared or specify the error condition. 
      </doc>
      <chassis name = "client" implement = "MAY" />
      
       <field name = "flags" domain = "short" label = "xa-ok, xa-rdonly, xa-rbrollback, xa-rbtimeout">
        <doc> 
         xa-ok: Normal execution.
         xa-rdonly: The transaction branch was read-only and has been committed.
         xa-rbrollback: The broker marked the transaction branch rollback-only for an unspecified reason.    
	 xa-rbtimeout: The work represented by this transaction branch took too long.    	 
        </doc>
        <assert check = "notnull" />	
      </field>
    </method>


    <!-- - - RECOVER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "recover" synchronous = "1" index = "50" label = "Get a list of Xids the RM has prepared or  heuristically completed">
      <doc>
       This method is called to obtain a list of transaction branches that are in a 
       prepared or heuristically completed state.
      </doc>
	
      <rule name = "internalError ">
         <doc>
        If an error occurs in recovering then the server MUST raise a channel exception with reply code 541 (internal error)
         </doc>
      </rule> 

      <rule name = "startEnd">
          <doc>
             If this endscan is used in conjunction with startscan then a single call starts and then ends a scan.	
          </doc>
      </rule>

      <rule name = "mustBeStarted">
          <doc>
             If none of endscan and startscan are set then a recovery scan must already be started otherwise the server MUST raise a channel exception with reply code 503 (command invalid)
          </doc>
      </rule>

      <chassis name = "server" implement = "MAY" />
      <response name = "recover-ok" />

      <field name = "ticket" domain = "access-ticket" label = "Access-ticket granted by the server for a specific realm">
        <doc>
          Access-ticket granted by the server for a specific realm. 
        </doc>
        <assert check = "notnull" />	
      </field>

      <field name = "startscan" domain = "bit" label = "Indicates that recovery scan should start">
        <doc> 
          Indicates that recovery scan should start. 
        </doc>
	<rule name = "recoveryAlreadyOpen">
          <doc>
           If a recovery scan is already open, the effect is as if the recovery scan were ended and then restarted.
          </doc>
        </rule>
        <assert check = "notnull" />	
      </field>
      
      <field name = "endscan" domain = "long" label = "indicates that the recovery scan should end after returning the Xids">
        <doc>           
	  Indicates that the recovery scan should end after returning the Xids. 	  
        </doc>
        <assert check = "notnull" />	
      </field>
    </method>

    <!-- - - RECOVER-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "recover-ok" synchronous = "1" index = "51" label = "list of Xids to be recovered">
      <doc>
       Returns to the client a table of transaction Xids that are in a prepared or heuristically completed state.
      </doc>

      <chassis name = "client" implement = "MAY" />
     
      <field name = "xids" domain = "table" label = "Table of xids to be recovered">
        <doc>
          table containing transaction Xids that are in a prepared or heuristically completed state.
        </doc>
        <assert check = "notnull" />	
      </field>
    </method>

    <!-- - - ROLLBACK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "rollback" synchronous = "1" index = "60" label = "Rollback a transaction branch">
      <doc>
        This method rolls back the work associated with xid. Any produced messages are discarded 
	and any consumed messages are re-enqueued.	
      </doc>

      <rule name = "internalError">
         <doc>
        If an error occurs in rolling back the transaction branch then the server MUST raise a channel exception with reply code 541 (internal error)
         </doc>
      </rule> 

      <rule name = "commandInvalid">
         <doc>
        If the method is invoked in an improper context (see class grammar) then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>

      <chassis name = "server" implement = "MAY" />
      <response name = "rollback-ok" />

      <field name = "ticket" domain = "access-ticket" label = "Access-ticket granted by the server for a specific realm">
        <doc>
          Access-ticket granted by the server for a specific realm. 
        </doc>
        <assert check = "notnull" />	
      </field>

      <field name = "xid" domain = "Xid" label = "Rollback any work associated with Xid xid">
        <doc> 
          Specifies the Xid of the transaction branch that can be rolled back.
        </doc>
        <assert check = "notnull" />	
	 <!-- rules -->
      <rule name = "unknownXid">
        <doc>
         If Xid is unknown (the transaction branch has not been started or has already been ended) then the server MUST raise a channel exception with reply code 404 (not found).
	 </doc>
      </rule>
      <rule name = "notdisassociated">
         <doc>
        If this method is called when Xid is still associated with a channel then the server MUST raise a channel exception with reply code 503 (command invalid)
         </doc>
      </rule>
      </field>
    </method>

  <!-- - - - ROLLBACK-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "rollback-ok" synchronous = "1" index = "61" label = "confirm distributed transaction rollback">
      <doc>
        This method confirms to the client that the transaction branch is rolled back or specify the error condition. 
      </doc>
      <chassis name = "client" implement = "MAY" />
      
       <field name = "flags" domain = "short" label = "xa-ok, xa-heurhaz, xa-heurcom, xa-heurrb, xa-heurmix, xa-rbrollback">
        <doc> 
         xa-ok: Normal execution,
	 xa-heurhaz: Due to some failure, the work done on behalf of the specified transaction branch may have been heuristically completed.
        xa-heurcom: Due to a heuristic decision, the work done on behalf of the specified transaction
   branch was committed.
	xa-heurrb: Due to a heuristic decision, the work done on behalf of the specified transaction
   branch was rolled back.
	xa-heurmix: Due to a heuristic decision, the work done on behalf of the specified transaction
   branch was partially committed and partially rolled back.
        xa-rbrollback: The broker marked the transaction branch rollback-only for an unspecified reason. 
	xa-rbtimeout: The work represented by this transaction branch took too long.        
        </doc>
        <assert check = "notnull" />	
      </field>
    </method>



   <!-- - - SETTIMEOUT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "set-timeout" synchronous = "1" index = "70" label = "Set the transaction timeout value">
      <doc>
        Sets the specified transaction branch timeout value in seconds.	
      </doc>

      <rule name = "internalError ">
         <doc>
        If an error occurs in setting the transaction timeout then the server MUST raise a channel exception with reply code 541 (internal error)
         </doc>
      </rule> 

      <rule name = "effective">
        <doc>
          Once set, this timeout value is effective until this method is reinvoked with a different value.
        </doc>
      </rule>

      <rule name = "reset">
        <doc>
          A value of zero resets the timeout value to the default value.
        </doc>
      </rule>

      <chassis name = "server" implement = "MAY" />
      <response name = "set-timeout-ok" />

      <field name = "ticket" domain = "access-ticket" label = "Access-ticket granted by the server for a specific realm">
        <doc>
          Access-ticket granted by the server for a specific realm. 
        </doc>
        <assert check = "notnull" />	
      </field>

       <field name = "xid" domain = "Xid" label = "Xid of the branch to set the timeout value">
        <doc> 
          Specifies the Xid of the transaction branch for setting the timeout.
        </doc>
        <assert check = "notnull" />	
	 <!-- rules -->
      <rule name = "unknownXid">
        <doc>
         If Xid is unknown (the transaction branch has not been started or has already been ended) then the server MUST raise a channel exception with reply code 404 (not found).
	 </doc>
      </rule>
      </field>

      <field name = "timeout" domain = "long" label = "The transaction timeout value in seconds">
        <doc> 
          The transaction timeout value in seconds.
        </doc>
        <assert check = "notnull" />	
      </field>
    </method>

    <!-- - - - SETTIMEOUT-OK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <method name = "set-timeout-ok" synchronous = "1" index = "71" label = "confirm timeout set">
      <doc>
        This method confirms that the timeout has been set. 
      </doc>
      <chassis name = "client" implement = "MAY" />
    </method> 
   </class>

<!-- Some other 0-10 previews: -->

  <class name="binding" handler="binding" index="130"
    label="provides the ability to query bindings">
    <doc>
      This is a utility class for querying and exchange about its bindings to queues.
    </doc>

    <chassis name="server" implement="MUST" />
    <chassis name="client" implement="MAY" />

    <method name="query" synchronous="1" index="10"
      label="request information about bindings to an exchange">
      <doc>
        This method is used to request information on the bindings to a particular exchange.  That
        information is conveyed in a query-ok method.
      </doc>

      <chassis name="server" implement="MUST" />
      <response name="query-ok" />

      <field name="ticket" domain="access-ticket">
        <rule name="validity" on-failure="access-refused">
          <doc>
            A valid ticket should be provided.
          </doc>
        </rule>
      </field>

      <field name="exchange" domain="shortstr" label="the exchange name">
        <doc>
           The name of the exchange for which binding information is being requested. If not
           specified explicitly the default exchange is implied.
        </doc>
      </field>

      <field name="queue" domain="shortstr" label="a queue name">
        <doc>
          If populated then determine whether the given queue is bound to the exchange.
        </doc>
      </field>

      <field name="routing-key" domain="shortstr" label="a routing-key">
        <doc>
         If populated defines the routing key of the binding of interest, if not populated the
         request will ignore the routing key on bindings when searching for a match.
        </doc>
      </field>

      <field name="arguments" domain="table" label="a set of binding arguments">
        <doc>
          If populated defines the arguments of the binding of interest if not populated the request
          will ignore the arguments on bindings when searching for a match
        </doc>
      </field>
    </method>

    <method name="query-ok" synchronous="1" index="11"
      label="returns information about bindings to exchange">
      <doc>
        This method is used in response to a query and conveys information on the bindings to a
        particular exchange.
      </doc>

      <chassis name="client" implement="MUST" />

      <field name="exchange-not-found" domain="bit" label="indicate an unknown exchange">
        <doc>
           If set, the exchange for which information was requested is not known.
        </doc>
      </field>

      <field name="queue-not-found" domain="bit" label="indicate an unknown queue">
        <doc>
           If set, the queue specified is not known.
        </doc>
      </field>

      <field name="queue-not-matched" domain="bit" label="indicate no matching queue">
        <doc>
          A bit which if set indicates that no binding was found from the specified exchange to the
          specified queue.
        </doc>
      </field>

      <field name="key-not-matched" domain="bit" label="indicate no matching routing key">
        <doc>
          A bit which if set indicates that no binding was found from the specified exchange with
          the specified routing key.
        </doc>
      </field>

      <field name="args-not-matched" domain="bit" label="indicate no matching args">
        <doc>
          A bit which if set indicates that no binding was found from the specified exchange with
          the specified arguments.
        </doc>
      </field>
     </method>
  </class>



  <class name="exchange" handler="channel" index="40" label="work with exchanges">
    <method name="query" synchronous="1" index="30" label="request information about an exchange">
      <doc>
        This method is used to request information on a particular exchange. That information is
        conveyed by an query-ok method.
      </doc>

      <chassis name="server" implement="MUST" />
      <response name="query-ok" />

      <field name="ticket" domain="access-ticket">
        <rule name="validity" on-failure="access-refused">
          <doc>
            A valid ticket should be provided.
          </doc>
        </rule>
      </field>

      <field name="name" domain="shortstr" label="the exchange name">
        <doc>
           The name of the exchange for which information is requested. If not specified explicitly
           the default exchange is implied.
        </doc>
      </field>
    </method>

    <method name="query-ok" synchronous="1" index="31" label="return exchange information">
      <doc>
        This method is used in response to a query request and conveys information on a particular
        exchange.
      </doc>

      <chassis name="client" implement="MUST" />

      <field name="type" domain="shortstr" label="indicate the exchange type">
        <doc>
           The type of the exchange. Will be empty if the exchange is not found.
        </doc>
      </field>

      <field name="durable" domain="bit" label="indicate the durability">
        <doc>
           The durability of the exchange, i.e. if set the exchange is durable. Will not be set if
           the exchange is not found.
        </doc>
      </field>

      <field name="not-found" domain="bit" label="indicate an unknown exchange">
        <doc>
           If set, the exchange for which information was requested is not known.
        </doc>
      </field>

      <field name="arguments" domain="table" label="other unspecified exchange properties">
        <doc>
          A set of properties of the exchange whose syntax and semantics depends on the server
          implementation. Will be empty if the exchange is not found.
        </doc>
      </field>
    </method>
  </class>

  <class name="execution" handler="execution" index="140">
    <doc>
      This class allows for efficiently communicating information
      about completion of processing.  
    </doc>

    <chassis name="server" implement="MUST"/>
    <chassis name="client" implement="MUST"/>

    <method name="flush" index="10" label="request an execution.complete return method">
      <chassis name="server" implement="MUST"/>
      <chassis name="client" implement="MUST"/>
    </method>

    <method name="complete" index="20">
      <chassis name="server" implement="MUST"/>
      <chassis name="client" implement="MUST"/>

      
      <field name="cumulative-execution-mark" domain="long" label="Low-water mark for command ids">
        <doc>
          The low-water mark for executed command-ids. All ids below this mark have been executed;
          above this mark, there are gaps containing unexecuted command ids (i.e. discontinuous). By
          definition, the first id above this mark (if it exists) is an unexecuted command-id.
        </doc>
      </field>


      <!-- The ranged mark on the complete method has been temporarily removed -->
    </method>

  </class>


</amqp>