How to clear symfony mailer queue - symfony

I have a lot of emails that were never sent in an app and queued.
I fixed a bug and they are all being sent but it's way too late right now.
Is there a way to clear the queue and delete all messages stored there ?

Related

IRC | asynchronous communitcation

I'm currently working on an IRC-Chat and we want to add the option to chat with other people privately (User-To-User) which works fine, but the messages aren't stored, meaning that a user loses all private messages after disconnecting. They also can't message a person once they have disconnected.
All of this isn't the case with channels, where messages are stored for X time, allowing a asynchronous communication.
Is there a way of allowing asynchronous messaging for private User-To-User messages without storing the messages in an extra system? Or is this simply a limitation of IRC?
IRC isn't designed to store messages - it's a feature, not a bug. One way to get around this is to configure the server to 'simulate' past messages (essentially pretending to be the other user to send past messages). To do this, you would need to store messages - however, it would be on the server itself, not on a separate database or a third party.

How to handle data replication lag and event notification

We have a simple application, who upon every update of an entity sends out a notification to SNS(it could very well have been any other queuing system). Clients are listening to these notifications and they do a get of updated entity based on these notifications.
The problem we are facing is, when clients do a get, sometimes data is not replicated and we return 404 or sometimes stale data(even worse).
How can we mitigate this while sending notifications?
Here are Few strategies to mitigate this with pros and cons
Instead of sending notification from application send notification using database streams
For example dynamodb streams ans aws lambda. This pattern can be useful in the case of multiregion deployment as well. where all the subscriber, publisher will subscribe to their regional database streams. And also atomicity of sending message and writing to database is preserved. And we wont loose events in the case of regional failure.
Send delayed messages to your broker
Some borkers like activemq and sqs support this functionality, but SNS does not. A workaround for that could be writing to sqs queue which then writes to sns. This might be a good option when your database does not support streams.
Send special error code for retry-able gets
Since we know that eventual consistency is there we can return special error code to clients, so that they can retry based on this error code. The retry strategy should be exponential backoff. but this may mean giving away your problems to clients. Also we should have some sort of versioning in place.
Fetch from another region
If entity is not found in the same region application can go to another region or master database to fetch it. NOTE Don't do this. as it is an anti pattern. I am mentioning it here just for the sake of completion.
Send the full entity in message
If entities to be fetched by rest service is small and there are no security constrain around who can access what, we can send the full entity in message. This is ensure that client don't have to do explicit fetch of it every time a new message is arrived.

How can a SignalR client detect logout?

NB: this question is about SignalR authentication events, not transport events, which I already have covered.
Scenario: I have my SignalR application open in 2 tabs. In one, I log out. In the other, my SignalR connection appears to stay connected, but no response is returned to requests sent through the hub. How can I detect this scenario? I'm already detecting errors, reconnect and disconnect events, but it doesn't seem to correspond to any state change at all. This feels like a relatively common scenario but I can't seem to find any documentation about it.
As far as I can tell, SignalR genuinely doesn't know you've been logged out, so there doesn't seem to be any nice way to do this. I've now implemented a separate http endpoint "IsLoggedIn" that returns true or false, and I poll that via Ajax to work out when the user becomes logged out, but there must be a better way...

Will published message with subscriber be persisted in the queue?

I just did a quick test and seem that the published messages with bus.Publish does not get persisted in msmq until it has a subscriber.
Did I do something wrong in the configuration?
Is this by design? And Why?
Thanks
That is how publish/subscribe works with MSMQ - when a publisher publishes a message, it will look for the queue names of the subscribers in its subscription storage, and send a copy of the message to each subscriber.
It follows from this that if there's no subscribers, then no messages are actually sent.
Logically, it works the same way when using multicast-capable transports like e.g. RabbitMQ - with RabbitMQ, then message will be published to the broker, which will then distribute a copy of the message to each subscriber - and again, if there are none, the message will no be delivered to anyone and thus cannot be seen anywhere.
I hope that makes sense :)

SignalR with unreliable or paused & reconnected connections?

I'm considering updating an existing site to use SignalR. My site polls a third party service for data changes, does some magic on it, and clients poll it once every few minutes to refresh their view with any updates.
SignalR seems like a great way to eliminate the polling from the client, but I want to know how SignalR handles dropped & reconnected connections, especially with regards to mobile web apps which may have been suspended for some time. Will it automatically negotiate and queue up any updates that were missed in the meantime, or does the client need to resynch from scratch in these cases? I looked but couldn't find any docs on this so guidance would be appreciated.
All this is definitely possible since the client keeps track of the last message id it saw. If it happened to miss messages, it'll get those the next time it goes back to the server (asking for all messages since the last one it saw).
By default the server side of SignalR stores messages in memory (and it purges those every few seconds), but you can change it to persist to some persistent store (see IMessageStore) if you're thinking about clients going offline and catching up.
You could even persist messages yourself in your own app logic while SignalR stores stuff in memory. It really depends on the application.
We haven't added any special support for mobile clients, but you can persist the message id in whatever local storage you need to for your mobile client.
Those details aren't very specific but what you want to do is all possible with SignalR.
Read Understanding and Handling Connection Lifetime Events in SignalR, especially these sections:
How to continuously reconnect - required to recover from a disconnected state;
How to notify the user about disconnections - so your app can not only inform the user, but detect state changes (disconnected, reconnecting, reconnected) to refresh your app's state in other ways.
That document was written in 2014 and basically obsoletes many of the wrong or incomplete StackOverflow SignalR-related questions/answers from the 2011-2012 era.

Resources