Where are the message sent to when ack deadline exceeds - google-cloud-pubsub

If multiple subscribers share the same pull subscription, when a message arrives at on subscriber, but it takes too long for the subscriber to ack the message, will the message be resent to the same subscriber or other subscribers? What if the subscriber dies before ack, which subscriber will the message be resent to?

Once a message that was delivered to a subscriber expires, it immediately becomes eligible for redelivery. Note that the message may or may not be delivered to the same subscriber binary; Cloud Pub/Sub gives no guarantees on “subscriber affinity/stickiness”.
In the same manner, if the subscriber binary dies before the ack can be sent, the message will be redelivered to another binary, after the ack expiration deadline.

Related

What happens when a server closes the connection and the client sends some data at the same time?

I have a server written in C that closes the connection if the connection is sitting idle for a specific time. I have an issue (that rarely happens). Read is failing on the client side and it says Connection broken. I suspect the server is closing the connection and the client is sending some data at the same time.
Consider the following scenario (A is server, B is the client)
B initiates the connection and the connection between A and B is established.
B is sitting idle and the idle timeout is reached.
A initiates the close
Before B receives the FIN from A, it starts sending request to A
After B sends the request, it will read the response
Since A has already closed the connection, B is not able to read.
My questions are
Is this a possible situation ?
How to handle idle timeout for clients?
How to close the connection between A and B properly (avoid B sending request during the process). In short, how to close the connection atomically?
By my only little more than rudimentary network experience... and assuming that you are talking about a connection-oriented connection like TCP/IP in contrary to UDP/IP that is connection-less.
Yes, of course. You cannot avoid it.
There are multiple ways to do it, but all of them include: Send something from the client before the server's timeout elapses. If the client has no data to send, let it send something like a "life sign". This could be an empty data message, it all depends on your application protocol. Or make the timeout as long as necessary, including some margin. Some protocol timeout only after 3 times of allowed idle time.
You cannot close the connection atomically, because client and server are separated. Each packet on the network needs some time to be transmitted, and both can start sending at the very same moment, the server its closing message, and the client a new data message. There is nothing that you can do about this.
You need to make the client handle this situation properly. For example, it can accept such a broken connection and interpret it as closed. You should have already some reaction, if the server closes the connection while the client is idle.
How to close the connection between A and B properly (avoid B sending request during the process).
Server detects timeout
Server sends timeout detection message to the Client
Server waits for a reply (if timeout, assume Client dead)
if Client receives a timeout detection from the Server, it replies with ACK (or something like that)
if Server receives an ACK from the Client, then 'gracefully' closes the connection
from now on, neither the Server nor the Client should send/receive any messages (after sending the ACK, do not immediately close the connection from the client side, do linger for the agreed timeout - see setsockopt: SO_LINGER)
On top of that, like the other answers suggested, the Client should send a heartbeat if idle (to avoid timeout detections).

Getting error "The operation has timed out." when my procedure send around 5000 emails

I have a procedure which identifies number of employees and send email to them dynamically (add names in TO / from).
Out of 5000 emails triggered only 700-800 gets sent other are in re-trying or failed status every time.
getting below error :
The mail could not be sent to the recipients because of the mail server failure.
(Sending Mail using Account 1 (2017-04-14T12:40:47).
Exception Message: Cannot send mails to mail server. (The operation has timed out.).
)
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2017-04-13T16:43:32). Exception Message: Cannot send mails to mail server. (Service not available, closing transmission channel.The server response was: 4.3.2 The maximum number of concurrent connections has exceeded a limit, closing transmission channel).

The server DISCONNECT and I receive LWT message?

Isn't if the server did not receive any messages from the client within the (1.5) * KeepAlivetime and the client did not send any PINGREQ within the aforementioned period, the server should DISCONNECT?
If yes, why I am receiving LWT message which is should not be received as DISCONNECT occures?
Last will and Testement will be sent if the client does not explicitly disconnect it's self.
If the broker disconnects the client due to a ping time out then the LWT will be sent, this is the specific reason why the LWT feature exists.
Or do you mean your now disconnected client is receiving it's own LWT?

subscriber information in zmq

I have a simple ZMQ 3.2 publisher which sends out messages and there are N number of subscribers that connect and disconnect to this publisher.
Is there any way in which the publisher can have details(IP, Name, Type... etc) of the subscriber that connects to it?

How to do a direct insert into SQL Server 2008 service broker queue

I am researching SQL Server 2008 Service Broker. I want to get data from a web service and insert it into a queue. I understand sending messages from one queue to another, but how do I get the data into the first queue, in the first place?
When you SEND a message, its goes directly to transmission queue and from transmission queue to target services queue.
If you want to keep message for the lifetime of conversation, then you can ALTER QUEUE and use RETENTION = ON. In this case, message will be deleted from sender queue, when conversation ends.

Resources