Skip to content

Alivetest Requests

Dominik Brader edited this page Apr 7, 2019 · 4 revisions

Description

An alivetest is part of the Fallback mechanism. If the alivetest returns alive, a search request can be sent to FINDOLOGIC. Otherwise the search request should be handled by the shops conventional search. If the returned status code is something else than 200, the shops conventional search should also be used instead of the FINDOLOGIC search.

Implementation

When sending search or navigation requests, an alivetest is automatically being sent before submitting the actual request. The only thing you need to care about is catching the ServiceNotAliveException when sending requests.

Examples

Search request

//  ...initialization...

try {
    /** @var XmlResponse $xmlResponse */
    $xmlResponse = $client->send($searchRequest);
} catch (ServiceNotAliveException $e) { // May be thrown by an unsuccessful alivetest or an invalid response.
    // ...call the shop search...
}

Navigation request

//  ...initialization...

try {
    /** @var XmlResponse $xmlResponse */
    $xmlResponse = $client->send($navigationRequest);
} catch (ServiceNotAliveException $e) { // May be thrown by an unsuccessful alivetest or an invalid response.
    // ...call the shop search...
}

Suggest request

//  ...initialization...

try {
    /** @var JsonResponse $xmlResponse */
    $xmlResponse = $client->send($suggestRequest);
} catch (ServiceNotAliveException $e) { // May be thrown by an invalid response. Alivetest is not sent for this request type.
    // ...call the shop search...
}