Commit Graph

23 Commits

Author SHA1 Message Date
melissaml 772db810a0 [Part1] Remove six
We don't need this in a Python 3-only world.
Remove six in follows:
1. zaqar/common/transport/wsgi/helpers.py
2. zaqar/common/urls.py
3. zaqar/common/utils.py
4. zaqar/notification/notifier.py
5. zaqar/notification/tasks/mailto.py

Change-Id: Iae6d4f415b215b9fdf675a0fcf00282fc98d58b7
2020-10-24 15:47:52 +08:00
wanghao 900bdbe3d9 Notification Delivery Policy
This patch introduces the delivery retry policy into Zaqar.
It will work when the notification sent from Zaqar to the
subscriber failed.
User can define the retry policy in the options of subscription or
metadata of queue.

Change-Id: I1a74c2d5b69fb82826c303468099db34b3e41b5b
Implements: bp notification-delivery-policy
2017-08-09 08:58:39 +08:00
Ngo Quoc Cuong ff822a3d21 Add log hacking rules
- [C312] Validate that logs are not translated. [1]
- [H904] Delay string interpolations at logging calls. [2]

[1]https://docs.openstack.org/oslo.i18n/latest/user/usage.html#creating-an-integration-module
[2]https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages

Change-Id: I0d42c52d90476f2eabbaf0eedfec5d6055117422
2017-07-05 03:12:32 -04:00
wanghao 59e939589e Remove unused None from dict.get()
Since the default value is None when can't get a key from a dict,
So there is no need to use dict.get('key', None).

Clear them from Zaqar code tree.

Change-Id: I96d3438e13893bbe994f2f93cb8945a04e4d3ff9
2017-06-27 16:32:48 +08:00
daohanli 0646f8034a Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Co-Authored-By: wanghao<sxmatch1986@gmail.com>

Closes-Bug: #1675247

Change-Id: I32dcbafd0f001ca4e1bf847735102e4bb22d37a5
2017-06-13 11:05:57 +08:00
wanghao 4778f708fa Subscription Confirmation Support-3
This patch is the third part of subscription confirmation feature.
Support to send email to subscriber if confirmation is needed.

Change-Id: I230f5c7fbc9d19554bbcf34ce9b2f3b14230321b
Implements: blueprint subscription-confirmation-support
2017-02-15 18:03:41 +08:00
Fei Long Wang 8e32ee254a Fix wrong value of require_confirmation
Currently, Zaqar's notifier driver will be initialized without
any parameter when creating the subscription controller. As a
result, default value 'False' will be used instead of getting
the correct value from conf. This patch will fix this by getting
the option from conf.

Closes-Bug: #1655812

Change-Id: I31ac8c3d374b3ea38d035f1012571e6c49a18b87
2017-01-13 10:05:09 +13:00
Fei Long Wang c19d0a0153 Don't send confirmation notification if it's not enabled
Currently even though the 'require_confirmation' option is False,
Zaqar will send the confirmation notification anyway, which is
breaking the backward compatibility. This patch will fix it and
add a test for that.

Closes-Bug: #1633222

Change-Id: I2d6363feab90ff737684d5c1d903c2c2d7abe106
2016-11-08 17:25:36 +13:00
wangxiyuan 69c799734b Subscription Confirmation Support-1
The subscription confirmation feature will contain four patches:
1. webhook with mongoDB
2. email with mongoDB
3. webhook with redis
4. email with redis

This patch is the first part of subscription confirmation feature for
webhook with MongoDB. Others will be achieved in follow patches.

This patch did:
1. Add v2/queue/<queue_name>/subscription/<subscription_id>/confirm
endpoint.
2. Add a new config option: "require_confirmation".
3. Add a new property "confirmed" to subscription resource for
MongoDB driver.
4. Add a new policy "subscription: confirm".
5. Add a new property "message type" for notification.
6. Use the pre-signed url in confirm request.
8. Re-use POST subscription to allow re-confirm.
9. Update notification for webhook subscription with mongoDB.
10. Support unsubscrib the subscription
11. Add tests for the feature.
12. Add doc and sample.
Docimpact
APIimpact

Change-Id: Id38d4a5b4f9303b12e22e2b5c248facda4c00143
Implements: blueprint subscription-confirmation-support
2016-08-16 17:23:45 +08:00
Thomas Herve 61100fec33 Fix subscription limit per queue
Query for all subscriptions on a given queue by taking into account the
returned marker, if any.

Change-Id: I6b03dd93cabc76d1c91041a896fbb30ac08032f1
Closes-Bug: #1590173
2016-06-08 11:33:45 +02:00
Junyuan Leng c1f0ac1302 Make the notifier max_workers configurable
Make the max_workers attribute of NotifierDriver configurable.
Now it can be configured using 'max_workers' parameter. Default
value of max_workers is 10.

Co-Authored-By: wangxiyuan<wangxiyuan@huawei.com>
Change-Id: Ice7d12199f8463793951932b48408e7df81440f2
2016-06-07 09:17:40 +08:00
Fei Long Wang 6250cde275 Improve the log to avoid unexpected ERROR
When notification pipeline and pooling are both enabled, the method
'post' of NotifierDriver will be called two times. One for normal
SubscriptionController and one for pooling.SubscriptionController.
So a check was added to avoid the notifition is sent two times, but
unfortunately an unintentional error was introduced. This patch fixes
it by refactoring the condition checking.

Change-Id: Ie22748e86a50b7d91f24707b0c5a3ab718f005a2
2016-05-28 02:21:10 +00:00
wanghao 1685f5853a Fix improperly LOG using in Zaqar
In zaqar, there are some improperly log using in code tree. Like in some
place, should use LOG.exception not LOG.error, repeat log calling, etc.

Those could be optimized for better code.

Change-Id: I99b830c4db4f2b9449cad713f37474f5ecbce05e
Closes-Bug: #1543563
2016-02-10 09:18:53 +08:00
Fei Long Wang 381ec25698 Fix duplicated notification
Now when the pooling is enabled, notification will be triggered two
times because the subscription controller of pooling is also in the
pipeline. This patch fixes it by checking the subscription controller
type.

Closes-Bug: #1489686

Change-Id: I55c72e3869e9b0490bcab3bcae571946bda65aa5
2015-09-03 11:05:31 +00:00
Fei Long Wang 8ce9d3eaef Add email driver for notification
DocImpact
blueprint email-notification

Change-Id: Ib09f7d3b47c3a4479da7fb9b9e2acceb691975ac
2015-09-03 11:46:00 +02:00
Thomas Herve a641baa978 Use thread executor all the time for notifier
Trying to use the greenlet executor doesn't work when we don't use
taskflow, as nothing is doing the monkeypatching. Let's use threads for
now.

Closes-Bug: #1491326

Change-Id: Ic59f75a883eff1d4f0e4683f9d8ea4d943ad7aac
2015-09-02 12:29:10 +02:00
Thomas Herve 75d11a8974 Use the executor directly in notifier
Instead of going through taskflow, use the executor directly in the
notifier, so that task execution doesn't block the pipeline and the main
loop when running.

Change-Id: I8cc555494d1d40ec7521046ce1b4a28b9b85e0ba
2015-08-11 17:58:21 +02:00
Fei Long Wang a128dbc3ac Refactor notification framework
1. Using stevedore to load the task instance
2. Pass in messages list to task instead of single message

Change-Id: Ie8a475b8c2530bfd0fb2d39929c1611288c601fe
2015-08-06 21:22:31 +12:00
Jenkins 55f1e3dbd1 Merge "Skip tasks run when there is no subscriber" 2015-08-05 02:49:19 +00:00
Joshua Harlow 83e313d9c9 Move to using the futurist library for async executors
This library replaces the taskflow library for this functionality
so it should be moved to instead of using the built-in taskflow
types (and utils).

Change-Id: I8b4099209246a2b79f404271f31ab1303211358c
2015-07-30 11:12:04 +02:00
Thomas Herve c4aad3b3e5 Skip tasks run when there is no subscriber
This skips taskflow launch when the notifier is called for a queue
without subscriber, preventing a traceback.

Change-Id: I63571a163efae523e52798fe4039f48859fa1fee
Closes-Bug: #1478841
2015-07-28 15:08:35 +02:00
Louis Taylor b006d033fd Port to oslo_log
This removes log.py from the oslo incubator and replaces it with the
graduated oslo_log module.

Change-Id: Ie0a41b4de9de25fdac3e925cd904e6cf6cd02627
2015-05-27 21:29:35 +00:00
Fei Long Wang 99fe10e49c Implement webhook notifier driver
This patch adds a notifier driver for webhook and the basic
task management code with taskflow.

DocImpact
Partially-Implements blueprint: notifications

Change-Id: I2727726cc57f03fb94184653452223f00fcf3d0c
2015-04-01 14:27:35 +13:00