How to determine is message was sended by QuickFix - connection

Actualy my problem touches network connection. Assume my program is sending some message and exactly at this moment network connection is down. As I realized, QuickFix notifies me with Application.onLogout. But I might call Session.sendToTarget before recieving onLogout. This is difficult situation and I need to know exactly was my message sent or wasn't. Is there a way to determine this?
Thanks for your answers

Pelasse take a look here:
How to determine if message is sent through QuickFIX
And put your attention at the heartbeat messages.

Related

How can I use visibility timeout as a "retry" mechanism?

My use case is that I have a queue from which my application reads messages. I need to delete the message if it is processed correctly, else I want it to stay in the queue. If my application processes the same message again, does that count as a "retry" based on which maximum receives works, or does maximum receives work as a different metric? if i cannot use it as a retry, can you help me with how I could go around implementing it?
Really sorry about the crude ideas I have compiled, but I am a newbie in terms of AWS, and wanted this done a bit quicker than expected.
Thanks for any help.
Maybe can you take a look on dead letter queues. When a message generate an unexpected error it can be retried according to maxReceiveCount, if there is still an error after all allowed retries then message will be moved in a dead letter queue according to redrive policy :
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
Hope this helps.

How to get the time of a received mqtt-message in node-red?

Can somenoe tell me how to get the publish-time of a mqtt message in node-red?
I have a retained message on my broker which gets fed to node-red via mqtt. The message is from a homematic wall-button which is hooked up to my broker via homegear.
The problem now is, that homegear retains all messages which is obviously good for sensors and so on. But the "true" message of the button - if pressed - also retains in it's topic.
On deploy or restart of node-red it will receive the retained message and act if when the message just arrived.
Till homegear will put a "false" in the topic after the button is pressed, I have to check if the message in the topic is not an old one. Any chance?
The mqtt help of node-red tells me there are only four properties from mqtt:
msg.topic, msg.payload, msg.qos, msg.retain.
Thanks for you help!
Cheers,
Patrik
Unfortunately there is no way to get the time the message was actually published, the fields you are getting (qos, retained, topic and payload) are the only data in the whole message (MQTT is specifically designed to be as light as possible so has the absolute minimum data in the headers).
The only way to get the time is for the publisher to include it in the message payload.

Erlang dead letter queue

Let's say my Erlang application receives an important message from the outside (through an exposed API endpoint, for example). Due to a bug in the application or an incorrectly formatted message the process handling the message crashes.
What happens to the message? How can I influence what happens to the message? And what happens to the other messages waiting in the process mailbox? Do I have to introduce a hierarchy of processes just to make sure that no messages are lost?
Is there something like Akka's dead letter queue in Erlang? Let's say I want to handle the message later - either by fixing the message or fixing the bug in the application itself, and then rerunning the message processing.
I am surprised how little information about this topic is available.
There is no information because there is no dead letter queue, if you application crashed while processing your message the message would be already received, why would it go on a dead letter queue (if one existed).
Such a queue would be a major scalability issue with not much use (you would get arbitrary messages which couldn't be sent and would be totally out of context)
If you need to make sure a message is processed you usually use a way to get a reply back when the message is processed like a gen_server call.
And if your messages are such important that it would be a catastrophe if lost you should probably persist it in a external DB, because otherwise if your computer crashes what would happen to all the messages in transit?

Raknet connection issue on Unity3D + iOS (il2cpp)

I have weird issue running the last version of Raknet on iOS with Unity3D: I get CONNECTION_ATTEMPT_FAILED when trying to connect to the server.
Now let's me detail the issue:
he exact same Library connects fine when used in an ObjectiveC application, so the issue seems to be Unity3D related.
I already managed to pinpoint my issue to be located in Raknet reliability layer:
Apparently, during the last step of the connection process (when the connection handshake as been completed) the reliability layer of the server thinks that the ID_CONNECTION_REQUEST packet received from the client is an acknowledgment instead of a message. Therefore it doesn't answer. Ultimately after a few tries, (and a 10s timeout) the client fails with the CONNECTION_ATTEMPT_FAILED error.
Does anybody there as an idea? I will update the question when I manage to get more info.
Update
We are using Unity3D 5.1.1f1
We managed to find a workaround! See answer for more information. As the workaround doesn't tell us much about what really happened, I would gladly hear some C++/XCode/Unity/iOS/AppleLLVM6.1 experts around here explain what really happened.
The issue was that the Raknet header wasn't properly generated by the iOS client. Namely we were sending ACK messages in place of simple packets. The rest of the message was considered as garbage by the server and the packet was dropped. The client kept trying to send the corrupted handshake packet a few times before timeouting.
This doesn't tell us why, doesn't it? Apparently the serialize method of the class DatagramHeaderFormat wasn't called as it should have been when running Raknet in Unity (iOS). Something else (and I don't know what) was linked in place of this method and was filling the BitStream with a corrupted header.
I am quite sure that the serialize method wasn't called because printf calls from inside weren't displayed in the console.
We renamed DatagramHeaderFormat::serialize into DatagramHeaderFormat::serializeHeader and... voila, it works.
Now I only want to understand what did the compiler (and why).

What happens in Erlang if return receipt never arrives?

I just happened to read the thesis of Joe Armstrong and don't have much prior knowledge of Erlang. I wonder what happens if a delivery receipt for some message never arrives. What does the sending actor do? It sends the message another time? This could confuse the recipient actor when it receives the same message another time. It has to be able to tell that its receipt was not received and therefore the second message is void.
That kind of problems always kept me away from solutions where message delivery is not transactional. I think I know the answer: the sending actor tells its supervising actor that something must be wrong when it didn't obtain a receipt in reasonable time causing the supervisor to take some action (like restarting the involed actors or something). Is this correct? I see no other solution that doesn't result in theroretically possible infinite message sends.
Thanks for any answer,
Oliver
In Erlang, the sender of a message usually forget it immediately after sending it and continue its job. if an application need an acknowledge of the message reception, you have to build your own protocol (or use an existing one). There are many good reason for that.
One is that most of the time it is not necessary to have this handshake. The higher risk for a message to be ignored is that the receiving process does not exist anymore, or died in the mean time, and the sender in this case has very few chance to do some interesting stuff.
Also, the hand shake is a blocking action, so there is a performance impact, and a risk of deadlock.
The acknowledge should be also a message, but this one should not be acknowledged, otherwise you create a never ending loop of message. Only the application could know what to do (for example using a send with acknowledge or not) and it is really easy to write this kind of function (or use a behavior that implement it). For example:
send_with_ack(To,Mess,TimeOut,Ack) ->
Ref = make_ref(),
To ! {Mess,self(),Ref},
receive
{Ack,Ref} -> Ack
after Timeout ->
{error,timeout}
end.
receiving_process() ->
...
receive
{Pattern_matching_Mess,From,Ref} ->
do_something(),
From ! {Ack,Ref}, %% Ack for this kind of message is known by the receiver
do_somethingelse();
Mess1 -> do_otherthing()
end,
...
with little work, it is even possible to delegate the survey of message delivery to a new process - not blocking check - and using linked process, force a crash of the sender if the timeout is reached.

Resources