I am trying to send SMS using my laravel project for that purpose I wrote function in MessageController named sendSms. I am pushing message data to a queue named SendScheduledSms and handler as follows.
public function handle()
{
$sentsms = App::make('App\Http\Controllers\MessageController')->sendSms($this->post_data);
}
Sending SMS works properly. $sentsms is the status of sent SMS. There are two values for $status, success and fail. I want to re-try sending same SMS if status is fail. How can I do that?
Now when sendSms executed, it deletes the queue.
I am using database queue.
Can anyone help?
In order to trigger Laravel Queue's native retry functionality, your Job handle method will need to throw an error at some point.
if ($sentsms == 'fail') {
throw new Exception('SMS failed to send.');
}
If you have a failed_jobs table set up the job should be moved there by Laravel.
See the documentation on Retrying failed jobs.
In your console schedule method set the --tries flag to have Laravel automatically rerun failed jobs.
$schedule->command("queue:work --tries=3")->everyMinute();
Related
https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/version-2.0/notify-rest-operations#compare-streaming-and-push-notifications
I am trying to subscribe push notification for user calendar events (create, update).
I am stuck on point. (ref: above doc url)
Heading:- Subscription process
Point# 3
Implementation in PHP (Laravel).
I successfully hit the api to subscribe push notification. but on my endpoint when I try to validate url it always retuning me bellow error.
My php (Laravel) code to validate url:-
return response($request->validationtoken, 200)
->header('Content-Type', 'text/plain');
Error Response:-
Array
(
[error] => Array
(
[code] => ErrorInvalidParameter
[message] => Notification URL 'https://fe6e2bee141e.ngrok.io/outlook-calendar/webhook?validationtoken=YmE1ODdiMzItODVmYy00YmI5LWJiZDgtMzViZGM0MGJkYzBj' verification failed 'System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.Exchange.OData.Model.Notifications.PushNotification.PushSubscriptionCallbackUrlValidationHelper.SendRequestAndVerifyResponse(Uri callbackUrl, PushSubscription pushSubscription)'.
)
)
Anyone can guide me what is wrong and how to do it in proper way? (If you can able to provide me php code reference that will be great.)
I am using Laravel 5.2. I am using Mail queue for sending email. Following is email queue syntax.
$mailArr = array();
$mailArr['subject'] = 'testing mail';
$mail_body = 'testing mail';
$mailArr['description'] = $mail_body;
Mail::to($email)->queue(new CustomMail($mailArr));
If I use "send" instead of "queue" then successfully receiving email.
Queue emails are going in Job table and attempting 3 times and then it is going in failed_jobs table.
In failed_jobs table, I am getting error ErrorException: fwrite(): SSL: Broken pipe in vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:231
I am processing queue with dispatcher and supervisor.
If I manually hit php artisan queue:work even then email is going but automatically with schedule:run written in cron job, is not working.
So any suggestions please what could be the reason?
This response is received when the remote connection closes without informing your server as to why. Usually due to a restriction, such as mail size.
Try using an alternative mailer, such as Mailtrap for example and try the queue again to see if the error response is different.
It is likely you had a plumbing issue; a huge email in your queue prior to your other emails, that’s why sends were processing fine but your queue wasn’t.
I am building an application using twilio's Task Router. I followed the quickstart tutorial at https://www.twilio.com/blog/2015/02/creating-a-priority-queue-for-your-call-centre-with-taskrouter.html.
I am able to get the task created. Assignment callback is also reaching the application. In the assignment callback response, I return the following JSON response,
{
"instruction": "dequeue"
"post_work_activity_sid": "WA157bdc5be67d91999de9fc68bb1d0f67"
}
The dequeue operation is not happening. I have double checked if I have assigned contact_uri for the worker. Still call is not reaching the worker. Menawhile, the portal says the worker is reserved. Eventually the call times out and the task gets marked as canceled.
My question is whether this ocurring because the worker's contact uri is another Twilio phone number I own. When I dial that contact uri , I am able to hear the "Say" response that I had preconfigured.
Does anybody have suggestion here?
In my project there is a requirement to create a job which will send multiple emails.. I was thinking to use Spring mail API. I checked there is a method
send(MimeMessage[] mimeMessages)
Which will send emails in batch, I have a question, if any of the mail failed while sending, will the whole job fails or rest of them will be sent? Is it possible to get a result that which one is successful and which one failed?
Have a look at https://github.com/SpringSource/spring-framework/blob/master/spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java.
Messages are sent individually and the send(MimeMessage[]) method throws MailSendException which contains the messages that failed to go.
I am using Autobahn and I have an implementation-specific question.
I am trying to figure out how to send a notice to all connected clients (including the newly subscribed client) upon a client subscribing to a topic. Here's the code (edited down for clarity):
#exportSub("", True)
def subscribe(self, topicUriPrefix, topicUriSuffix):
topic_uri = "%s%s" % (topicUriPrefix, topicUriSuffix)
self.client.dispatch(topic_uri, {"msg":"WTF"})
return True
Yet, I'm not seeing the newly subscribed message receive this dispatch. The dispatch call is returning None.
What's happening here?
I figured this out. A client must first be subscribed to a topic before receiving a message sent via dispatch(). This means that the dispatch() cannot be called inside subscribe if one expect the subscribing client to receive the message. I worked around this problem by building a simple message queue and calling dispatch on the protocol instance for any queued messages.