1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package de.kaiserpfalzedv.services.eansearch.client;
19
20 import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
21
22 import java.util.Set;
23
24 import org.springframework.cloud.openfeign.FeignClient;
25 import org.springframework.web.bind.annotation.GetMapping;
26 import org.springframework.web.bind.annotation.RequestParam;
27
28 import de.kaiserpfalzedv.services.eansearch.model.EanData;
29 import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
30 import io.github.resilience4j.retry.annotation.Retry;
31 import io.micrometer.core.annotation.Counted;
32 import io.micrometer.core.annotation.Timed;
33
34
35
36
37
38
39
40
41 @FeignClient(name = "eansearch", configuration = EanSearchClientConfig.class, path = "/api")
42 public interface EanSearchClient {
43 @GetMapping(produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
44 @Retry(name = "eansearch")
45 @CircuitBreaker(name = "eansearch")
46 @Timed("ean-search.lookup.ean.time")
47 @Counted("ean-search.lookup.ean.count")
48
49
50 Set<EanData> barcodeLookupEAN(@RequestParam("ean") final String ean13);
51
52 @GetMapping(produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
53 @Retry(name = "eansearch")
54 @CircuitBreaker(name = "eansearch")
55 @Timed("ean-search.lookup.upc.time")
56 @Counted("ean-search.lookup.upc.count")
57
58
59 Set<EanData> barcodeLookupUPC(@RequestParam("upc") final String upc12);
60
61 @GetMapping(produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
62 @Retry(name = "eansearch")
63 @CircuitBreaker(name = "eansearch")
64 @Timed("ean-search.lookup.isbn.time")
65 @Counted("ean-search.lookup.isbn.count")
66 Set<EanData> barcodeLookupISBN(@RequestParam("isbn") final String isbn10);
67 }