FAQ and Tips

FAQ and Tips

  • Does LHV Connect support multithreading? Short answer is no, but we are planning improvements here. You can actually submit requests from multiple client threads with your connection certificate, but you can read your responses with GET /messages/next service from one source at a time only. As the service only returns the oldest non-processed message from the queue until you execute the DELETE /messages/.. request.

  • How often can I request to read new messages? Every customer and its needs are different, but the most frequent mistake we have noticed is constantly polling with some fixed delay for new messages with GET /messages/next service. For example read a message every 10s one by one. Best practice is to loop through the bigger sets of transactions in batches. You can actually poll through the messages as fast as the interface responds and not lose the precious seconds. Once the current batch of transactions or any other messages pending is processed (HTTP response code 204 means there are no more messages) you can take a bit longer break and then try again. As a result you should get your messages as fast as possible (several per second) and at the same time avoid the constant polling on our interface. An example in pseudocode:

    While (active_time==true) { // your business hours
        //loop until you get http result 204 = no content (no new messages)
        While (result != 204) {
            // read next message
            result = GET https://connect.lhv.eu/messages/next
            msgid = result.Message-Response-Id // get the HTTP header Message-Response-Id
    
            ProcessMessage(result) // whatever you do with the message
            DELETE https://connect.lhv.eu/messages/[msgid]
        }
        Sleep 10 min // adjust according to your actual needs
    }

Last updated