grook

Untitled

Jun 15th, 2021
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. public clsas YouTrackReceiver implements IReceiver{
  2.  
  3.     private WebClient client;
  4.     private BlockingQueue<JsonNode> receivedEventData;
  5.     private final String url = "https://youtrack.jetbrains.com/api"
  6.  
  7.     public YouTrackReceiver(BlockingQueue<JsonNode> receivedEventData){
  8.         // Объявляем HTTP клиент для взаимодействия с API по заданному URL
  9.         receivedEventData = receivedEventData;
  10.         HttpClient httpClient = HttpClient.create();
  11.         client = WebClient.builder()
  12.                 .clientConnector(new ReactorClientHttpConnector(httpClient))
  13.                 .baseUrl(url)
  14.                 .defaultHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON_VALUE)
  15.                 .build();
  16.     }
  17.  
  18.     public void receive() {
  19.         // Асинхронно вызываем методы опроса ресурсов API
  20.         receiveIssueCreatedActivities();
  21.         receiveIssueResolvedActivities();
  22.         receiveCommentActivities();
  23.         receiveCommentAttachmentActivities();
  24.         receiveTimeTrackActivities();
  25.     }
  26. }
Add Comment
Please, Sign In to add comment