File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change
1
+ // Setup queue module and start Tarantool instance before execution:
2
+ // Terminal 1:
3
+ // $ make deps
4
+ // $ TT_LISTEN=3013 tarantool queue/config.lua
5
+ //
6
+ // Terminal 2:
7
+ // $ cd queue
8
+ // $ go test -v example_test.go
1
9
package queue_test
2
10
3
11
import (
@@ -8,16 +16,22 @@ import (
8
16
"github.com/tarantool/go-tarantool/queue"
9
17
)
10
18
11
- func ExampleConnection_Queue () {
19
+ // Example_simpleQueue demonstrates an operations like Put and Take with queue.
20
+ func Example_simpleQueue () {
12
21
cfg := queue.Cfg {
13
22
Temporary : false ,
14
23
Kind : queue .FIFO ,
15
24
Opts : queue.Opts {
16
25
Ttl : 10 * time .Second ,
17
26
},
18
27
}
28
+ opts := tarantool.Opts {
29
+ Timeout : 2500 * time .Millisecond ,
30
+ User : "test" ,
31
+ Pass : "test" ,
32
+ }
19
33
20
- conn , err := tarantool .Connect (server , opts )
34
+ conn , err := tarantool .Connect ("127.0.0.1:3013" , opts )
21
35
if err != nil {
22
36
fmt .Printf ("error in prepare is %v" , err )
23
37
return
@@ -64,4 +78,6 @@ func ExampleConnection_Queue() {
64
78
fmt .Printf ("Task should be nil, but %d" , task .Id ())
65
79
return
66
80
}
81
+
82
+ // Output: data_1: test_data_1
67
83
}
You can’t perform that action at this time.
0 commit comments