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
+15-5Lines changed: 15 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ from eb_sqs.decorators import task
25
25
26
26
@task(queue_name='test')
27
27
defecho(message):
28
-
printmessage
28
+
print(message)
29
29
30
30
echo.delay(message='Hello World!')
31
31
```
@@ -56,10 +56,10 @@ from eb_sqs.decorators import task
56
56
57
57
@task(queue_name='test', max_retries=5)
58
58
defupload_file(message):
59
-
print'# of retries: {}'.format(upload_file.retry_num)
59
+
print('# of retries: {}'.format(upload_file.retry_num))
60
60
try:
61
61
# upload ...
62
-
expect ConnectionException:
62
+
except ConnectionException:
63
63
upload_file.retry()
64
64
```
65
65
@@ -69,7 +69,7 @@ The retry call supports the `delay` and `execute_inline` arguments in order to d
69
69
70
70
#### Executing Tasks
71
71
72
-
The Elastic Beanstalk Worker Tier sends all tasks to a API endpoint. django-eb-sqs has already such an endpoint which can be used by specifing the url mapping in your `urls.py` file.
72
+
The Elastic Beanstalk Worker Tier sends all tasks to a API endpoint. django-eb-sqs has already such an endpoint which can be used by specifying the url mapping in your `urls.py` file.
73
73
74
74
```python
75
75
urlpatterns = [
@@ -105,9 +105,16 @@ python manage.py process_queue --queues <comma-delimited list of queue names>
105
105
106
106
This is a good idea for someone who wants to execute tasks without an Elastic Beanstalk worker.
107
107
108
+
You can either use full queue names, or queue prefix using `prefix:*my_example_prefix*` notation.
109
+
110
+
Examples:
111
+
```bash
112
+
python manage.py process_queue --queues queue1,queue2 # process queue1 and queue2
113
+
python manage.py process_queue --queues queue1,prefix:pr1-,queue2 # process queue1, queue2 and any queue whose name starts with 'pr1-'
114
+
```
108
115
109
116
#### Group Tasks
110
-
Multiple tasks can be grouped by specifing the `group_id` argument when calling `delay` on a task.
117
+
Multiple tasks can be grouped by specifying the `group_id` argument when calling `delay` on a task.
111
118
If all tasks of a specific group are executed then the group callback task specified by `EB_SQS_GROUP_CALLBACK_TASK` is executed.
112
119
113
120
Example calls:
@@ -134,6 +141,8 @@ The following settings can be used to fine tune django-eb-sqs. Copy them into yo
134
141
- EB_SQS_MAX_NUMBER_OF_MESSAGES (`10`): The maximum number of messages to read in a single call from SQS (<= 10).
135
142
- EB_SQS_WAIT_TIME_S (`2`): The time to wait (seconds) when receiving messages from SQS.
136
143
- EB_SQS_AUTO_ADD_QUEUE (`False`): If queues should be added automatically to AWS if they don't exist.
144
+
- EB_SQS_QUEUE_MESSAGE_RETENTION (`1209600`): The value (in seconds) to be passed to MessageRetentionPeriod parameter, when creating a queue (only relevant in case EB_SQS_AUTO_ADD_QUEUE is set to True).
145
+
- EB_SQS_QUEUE_VISIBILITY_TIMEOUT (`300`): The value (in seconds) to be passed to VisibilityTimeout parameter, when creating a queue (only relevant in case EB_SQS_AUTO_ADD_QUEUE is set to True).
137
146
- EB_SQS_DEAD_LETTER_MODE (`False`): Enable if this worker is handling the SQS dead letter queue. Tasks won't be executed but group callback is.
138
147
- EB_SQS_DEFAULT_DELAY (`0`): Default task delay time in seconds.
139
148
- EB_SQS_DEFAULT_MAX_RETRIES (`0`): Default retry limit for all tasks.
@@ -148,6 +157,7 @@ The following settings can be used to fine tune django-eb-sqs. Copy them into yo
148
157
- EB_SQS_REDIS_KEY_PREFIX (`eb-sqs-`): Prefix used for all Redis keys
149
158
- EB_SQS_USE_PICKLE (`False`): Enable to use `pickle` to serialize task parameters. Uses `json` as default.
150
159
- EB_SQS_AWS_MAX_RETRIES (`30`): Default retry limit on a boto3 call to AWS SQS.
160
+
- EB_SQS_REFRESH_PREFIX_QUEUES_S (`10`): Minimal number of seconds to wait between refreshing queue list, in case prefix is used
0 commit comments