README.md
changeset 3 d0bc42746346
parent 2 48806dfcbba5
child 10 d63cce6d1a09
equal deleted inserted replaced
2:48806dfcbba5 3:d0bc42746346
    80 
    80 
    81 client.receipt_callback = accept_receipt
    81 client.receipt_callback = accept_receipt
    82 client.connect
    82 client.connect
    83 
    83 
    84 var headers = seq[ tuple[name:string, value:string] ]
    84 var headers = seq[ tuple[name:string, value:string] ]
    85 headers.add( "x-breakfast", "tequila" )
    85 headers.add( ("x-breakfast", "tequila") )
    86 headers.add( "receipt", "special-identifier" )
    86 headers.add( ("receipt", "special-identifier") )
    87 
    87 
    88 client.send( "/destination", "message!", "text/plain", headers )
    88 client.send( "/destination", "message!", "text/plain", headers )
    89 ```
    89 ```
    90 
    90 
    91 
    91 
   114 client.begin( "trans-1" )
   114 client.begin( "trans-1" )
   115 client.begin( "trans-2" )
   115 client.begin( "trans-2" )
   116 client.begin( "trans-3" )
   116 client.begin( "trans-3" )
   117 
   117 
   118 var headers = seq[ tuple[name:string, value:string] ]
   118 var headers = seq[ tuple[name:string, value:string] ]
   119 headers.add( "transaction", "trans-1" )
   119 headers.add( ("transaction", "trans-1") )
   120 client.send( "/destination", "hi", nil, headers ) # Part of "trans-1"
   120 client.send( "/destination", "hi", nil, headers ) # Part of "trans-1"
   121 
   121 
   122 headers = @[]
   122 headers = @[]
   123 headers.add( "transaction", "trans-2" )
   123 headers.add( ("transaction", "trans-2") )
   124 client.send( "/destination", "hi", nil, headers ) # Part of "trans-2"
   124 client.send( "/destination", "hi", nil, headers ) # Part of "trans-2"
   125 client.ack( "some-ack-id", "trans-2" ) # Part of "trans-2"
   125 client.ack( "some-ack-id", "trans-2" ) # Part of "trans-2"
   126 
   126 
   127 headers = @[]
   127 headers = @[]
   128 headers.add( "transaction", "trans-3" )
   128 headers.add( ("transaction", "trans-3") )
   129 client.send( "/destination", "hi", nil, headers ) # Part of "trans-3"
   129 client.send( "/destination", "hi", nil, headers ) # Part of "trans-3"
   130 client.ack( "some-ack-id", "trans-3" ) # Part of "trans-3"
   130 client.ack( "some-ack-id", "trans-3" ) # Part of "trans-3"
   131 
   131 
   132 client.abort( "trans-1" )  # anything "trans-1" never happened
   132 client.abort( "trans-1" )  # anything "trans-1" never happened
   133 client.commit( "trans-2" ) # "trans-2" messages and acks are released
   133 client.commit( "trans-2" ) # "trans-2" messages and acks are released