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.RequestMapping;
26 import org.springframework.web.bind.annotation.RequestMethod;
27 import org.springframework.web.bind.annotation.RequestParam;
28
29 import de.kaiserpfalzedv.services.eansearch.model.EanData;
30 import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
31 import io.github.resilience4j.retry.annotation.Retry;
32 import io.micrometer.core.annotation.Counted;
33 import io.micrometer.core.annotation.Timed;
34
35
36
37
38
39
40
41
42 @FeignClient(name = "eansearch", configuration = EanSearchClientConfig.class, path = "/api")
43 public interface EanSearchClient {
44 @RequestMapping(method = RequestMethod.GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
45 @Retry(name = "eansearch")
46 @CircuitBreaker(name = "eansearch")
47 @Timed("ean-search.lookup.ean.time")
48 @Counted("ean-search.lookup.ean.count")
49
50
51 Set<EanData> barcodeLookupEAN(@RequestParam("ean") final String ean13);
52
53 @RequestMapping(method = RequestMethod.GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
54 @Retry(name = "eansearch")
55 @CircuitBreaker(name = "eansearch")
56 @Timed("ean-search.lookup.upc.time")
57 @Counted("ean-search.lookup.upc.count")
58
59
60 Set<EanData> barcodeLookupUPC(@RequestParam("upc") final String upc12);
61
62 @RequestMapping(method = RequestMethod.GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
63 @Retry(name = "eansearch")
64 @CircuitBreaker(name = "eansearch")
65 @Timed("ean-search.lookup.isbn.time")
66 @Counted("ean-search.lookup.isbn.count")
67 Set<EanData> barcodeLookupISBN(@RequestParam("isbn") final String isbn10);
68 }