[Koha-bugs] [Bug 14791] Automatically attempt to resend failed notices

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Apr 8 17:16:15 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791

Lari Taskula <lari.taskula at hypernova.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #62622|0                           |1
        is obsolete|                            |

--- Comment #13 from Lari Taskula <lari.taskula at hypernova.fi> ---
Created attachment 87527
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=87527&action=edit
Bug 14791: Automatically resend SMS notices that failed due to network problems

Sometimes notices keep failing due to various reasons. One common problem
is network connection failures. Because of this, the notices go into 'failed'
state. This is very problematic, because we have to not only monitor the failed
messages but also resend them manually. The purpose of this patch is to enable
more automated way of handling delivery failures.

This patch enables us to handle exceptions in SMS messaging. The main idea
is to throw an exception from SMS::Send driver in case of a failure.
The exception will be caught by C4::SMS and from here it will be forwarded
to C4::Letters, where instead of automatically setting the message into
'failed' status, we now can decide what to do with the message.

As an example I have caught Koha::Exceptions::ConnectionFailed in
C4::Letters::_send_message_by_sms(). When we catch the said exception,
we simply leave the message in 'pending' status.  This way it will be resent
whenever process_message_queue.pl is executed again.

sub send_sms {
    #.....your implementation.....

    # Throw an exception in case of a connection error
    # $connError can be for example: ($curl->{'retcode'} == 6)
    # cURL code 6: CURLE_COULDNT_RESOLVE_HOST
    if ($connError){
        Koha::Exceptions::ConnectionFailed->throw(error => "Connection
failed");
    }
}

To test:
1. prove t/db_dependent/Letters.t

Also testable with your own implementation of SMSSendDriver.
1. Have/create some pending sms messages into message_queue
2. Go to Patrons -> Notices
3. Observe that the your message is in pending status
4. Run misc/cronjob/process_message_queue.pl
5. Observe that the message is no longer pending
6. Add Koha::Exceptions::ConnectionFailed->throw(error => "Connection failed");
   to your SMS::Send driver send_sms.
7. Set your message back to pending status
8. Run misc/cronjob/process_message_queue.pl
9. Observe that your message is back in pending status
10. Observe it also has the following delivery note:
    "Connection failed. Attempting to resend."

Sponsored-by: Hypernova Oy

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list