#2677676: Automated Messages & Sleep needs a queue system for SMS messages,
#2677684: Add SMS message entity / storage is a prerequisite.
| Comment | File | Size | Author |
|---|---|---|---|
| #36 | sms-queue-processor-2677682-36.patch | 85.18 KB | dpi |
| #31 | sms-queue-processor-2677682-31.patch | 82.51 KB | dpi |
| #27 | sms-queue-processor-2677682-27.patch | 62.88 KB | dpi |
| #23 | sms-queue-processor-2677682-23.patch | 61.62 KB | dpi |
| #19 | sms-queue-processor-2677682-19.patch | 45.84 KB | dpi |
Comments
Comment #2
almaudoh commentedHaving a queue is also a good idea in the case where a huge volume of messages needs to be sent and the UX would be adversely affected if the sending of the messages were attempted immediately...
Comment #3
dpiComment #4
dpiComment #5
dpiComment #6
almaudoh commentedThe FIFO dispatch queue should have a means of querying the current percentage completion or status. That is something the current D8 queue system doesn't have.
Comment #7
dpiI intended to float the idea of doing the same thing as Courier:
Comment #8
dpiNow working on this since #2677684: Add SMS message entity / storage Assigned to: dpi is committed. We can continue to change the SMS message entity as required.
Comment #9
dpiThere are some messages in #2677684: Add SMS message entity / storage which are better suited to this issue:
Comment #10
dpiI should have this feature complete by the end of the weekend. Its all working as is, ready for testing.
@todo:
PR is here https://github.com/dpi/smsframework/pull/11
Diff is here https://github.com/dpi/smsframework/pull/11/files
PR is mostly internals changes, there are two UI additions:
Adding skip queue and retention settings to gateways:
New report line items as suggested in #6:
Comment #11
dpiIve pushed the commits with max recipients-per-message chunking feature.
Would like your opinion on how the queue and send methods work/should be organised. Something to consider is the current send() method completely circumvents message chunking.
Comment #12
dpiLets see whats broken.
Comment #16
dpiWhat remains...?
Comment #17
almaudoh commentedOne useful feature would be the ability to query the queue and get the status of the message dispatching progress. Maybe an API hook which we can flesh out later (the
hook_requirements()status is ok for a start, but I would want to, for instance, show a progress bar to a user who just sent 10,000 messages).I'm still reviewing the code and implementation...
Comment #18
dpiHmm, a progress bar is simply a percentage. If I'm interpreting you correctly it could be deceptive due to retention. Eg there could always be 100% remaining if ret = 0.
This is why I went with the countdown route. There are a higher count of messages in the database, but some may have already been garbage collected.
Comment #19
dpiJust testing, no need to review.
Rejiggering how skip_queue works for test, Wont pass -- seeing whats broken.
Comment #23
dpiagain, just for testbot
removing usages of
$this->testGatewayand require tests to create their own gateway if they need it. Better to do this than blanketly change send_queue value from default.Comment #27
dpiComment #31
dpirunning tests - this one has a bunch of new tests
Comment #35
dpii was going through the motions to add chunking to send(), in case code was not going through the queue system. But I realise that it doesnt make sense at this time.
the return value of send() is a single result. If we are to split the message into >1 messages to accommodate chunking requirement, then multiple messages would be sent within send(). This means in more than one return result would occur. this would be an API change.
There are some things we can do:
Disallow usage of send() if the amount of recipients is over the gateway plugin limit, by thowing an exception. :( . And/or,
Force usage of queue, since it does not have a return value.
Comment #36
dpiPatch as of e982cfc. Hopefully tests are fixed.
Comment #37
dpiAPI breaks/modifications:
DefaultSmsProvideryou will get errors.$this->testGatewaythey will need to create their own gateways withcreateMemoryGateway. ThetestGatewaywas removed so tests would have to explicitly opt out ofskip_queue.randomPhoneNumbersto it always returns at least 2 numbers, since the function name implies plurality. Returning random 0-1 could introduce random test failures. Also added optional phone number quantity parameter torandomPhoneNumbers.Ive committed the PR since there's full tests coverage. I think we should still hack at the
DefaultSmsProviderto improvesend/queue/queueOut/queueIn.Do you have any work in progress, or taking a time out this week?
Comment #39
almaudoh commentedA way I implemented it in SMS gatewaya module was to recombine the results. I don't think it is much of an APP change since we are in beta phase, we can still do it. But we would really lose a lot if we only have to use chunked messages when we queue. A good example is the scheduled SMS which is dispatched with crop. Since we are in crop already, what need of queuing do we have?
Comment #40
dpiWhich module?
Its still a quirky thing to do. Pass one SMS message in, receive an unpredictable number of SMS results out.
huh?
Comment #41
almaudoh commentedSorry my phone auto correct went haywire. I meant cron not crop.
Comment #42
dpiIm not sure I understand this point. Cron doesnt queue anything, cron processes whats in the queue.
This is the existing process:
Message creation page.;
This portion is message creation and storage. all message entity creation, and saving is done here, in case there is problems with sms message contraint/validation. or if there are issues interacting in bulk with the database. failures should be reduced by database transactions, but are still possible.
Cron:
This portion is purely interacting with drupal::queue and gateway plugins. there is no new message entity creation in cron to minimise potential silent failures.
sms_cron():Drupal cores'
Cron::run()Comment #43
dpiAlright since this is an API change to code not created by this issue I'll create another issue: #2707559: Chunk messages sent directly to Provider::send
Comment #44
almaudoh commentedOk, I wasn't very clear there. I have a module I'm doing which allows the user to schedule messages to be sent later. The current implementation actually uses a custom schema, but I want to see if I can use the new
SmsMessageentity.Let's say these messages are saved using the new persistence layer, and then dispatched at the appropriate time using a cron job. It doesn't make much sense to queue these again (just for the benefit of chunking) and wait for another cron job to dispatch it since scheduled messages need to be sent at the exact time if possible.
Comment #45
dpiThey arnt queued again, they are just added to the Drupal queue system because that system manages time efficiently (Manages PHP timeouts and available system memory/PHP process max memory).
We are effectively saying everything in the {sms} table are sms that need to be sent. The Drupal queue system creates tasks to send them. Drupal will claim a task, and that task will expire. If the gateway throws an endpoint failure then when the task claim expires it will be reprocessed.
The system timing uses minimums because cronjobs are unreliable. So if you schedule something for 6pm, it will be sent as soon as it can after that time. If super accurate timing is required then I would schedule the cron job every 15/30/60 seconds. Or just send the message directly through send().
The queue doesnt exist to serve chunking. Its there to manage time and balance load, especially if gateway endpoints are taking too long to process each request.
Comment #46
almaudoh commentedThat's exactly what I'm driving at, we lose the benefit of chunking if I send directly through
send(). Hence chunking should be moved tosend()method.Exactly the point... :)
Comment #47
dpiIm sorry, I should have linked to #2707559: Chunk messages sent directly to Provider::send. I plan to add chunking to SMS send.
So for queued messages, when they are processed by Drupal::queue, they will go through send. Send will try to chunk, but they are already pre-chunked.
Comment #48
dpiWhat I'm trying to say is: Double. Chunk
Comment #49
dpiComment #58
dpi