You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-26Lines changed: 12 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -57,11 +57,9 @@ Machinery is an asynchronous task queue/job queue based on distributed message p
57
57
*[Dependencies](#dependencies)
58
58
*[Testing](#testing)
59
59
60
-
### V2 Experiment
60
+
### V2
61
61
62
-
Please be advised that V2 is work in progress and breaking changes can and will happen until it is ready.
63
-
64
-
You can use the current V2 in order to avoid having to import all dependencies for brokers and backends you are not using.
62
+
I recommend using V2 in order to avoid having to import all dependencies for brokers and backends you are not using.
65
63
66
64
Instead of factory, you will need to inject broker and backend objects to the server constructor:
67
65
@@ -82,32 +80,22 @@ server := machinery.NewServer(cnf, broker, backend, lock)
82
80
83
81
### First Steps
84
82
85
-
Add the Machinery library to your $GOPATH/src:
83
+
To install recommended v2 release:
86
84
87
85
```sh
88
-
go get github.com/RichardKnop/machinery/v1
86
+
go get github.com/RichardKnop/machinery/v2
89
87
```
90
88
91
-
Or to get experimental v2 release:
89
+
If you want to use legacy v1 version, you still can:
92
90
93
91
```sh
94
-
go get github.com/RichardKnop/machinery/v2
92
+
go get github.com/RichardKnop/machinery
95
93
```
96
94
97
-
First, you will need to define some tasks. Look at sample tasks in `example/tasks/tasks.go` to see a few examples.
95
+
First, you will need to define some tasks. Look at sample tasks in `v2/example/tasks/tasks.go` to see a few examples.
98
96
99
97
Second, you will need to launch a worker process with one of these commands (v2 is recommended since it doesn't import dependencies for all brokers / backends, only those you actually need):
100
98
101
-
```sh
102
-
go run example/amqp/main.go worker
103
-
go run example/redis/main.go worker
104
-
105
-
go run example/amqp/main.go worker
106
-
go run example/redis/main.go worker
107
-
```
108
-
109
-
You can also try v2 examples.
110
-
111
99
```sh
112
100
cd v2/
113
101
go run example/amqp/main.go worker
@@ -123,12 +111,10 @@ go run example/redis/main.go worker
123
111
Finally, once you have a worker running and waiting for tasks to consume, send some tasks with one of these commands (v2 is recommended since it doesn't import dependencies for all brokers / backends, only those you actually need):
124
112
125
113
```sh
126
-
go run example/v2/amqp/main.go send
127
-
go run example/v2/redigo/main.go send // Redis with redigo driver
128
-
go run example/v2/go-redis/main.go send // Redis with Go Redis driver
129
-
130
-
go run example/v1/amqp/main.go send
131
-
go run example/v1/redis/main.go send
114
+
cd v2
115
+
go run v2/example/amqp/main.go send
116
+
go run v2/example/redigo/main.go send // Redis with redigo driver
117
+
go run v2/example/go-redis/main.go send // Redis with Go Redis driver
132
118
```
133
119
134
120
You will be able to see the tasks being processed asynchronously by the worker:
@@ -137,7 +123,7 @@ You will be able to see the tasks being processed asynchronously by the worker:
137
123
138
124
### Configuration
139
125
140
-
The [config](/v1/config/config.go) package has convenience methods for loading configuration from environment variables or a YAML file. For example, load configuration from environment variables:
126
+
The [config](/v2/config/config.go) package has convenience methods for loading configuration from environment variables or a YAML file. For example, load configuration from environment variables:
0 commit comments