Last active
November 23, 2020 13:51
-
-
Save zpapez/bdd6949331bffb727c8780f1870f8181 to your computer and use it in GitHub Desktop.
ControllerAndServiceCallingJiraAndSlack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
import lombok.RequiredArgsConstructor; | |
@RestController | |
@RequestMapping("/api/v1") | |
@RequiredArgsConstructor | |
public class Controller { | |
private final MyService service; | |
@GetMapping("/resource") | |
public String getResource() { | |
service.fetchData(); | |
return "OK result"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.stereotype.Service; | |
import cz.zpapez.springfeignclients.slack.SlackFeignClient; | |
import cz.zpapez.springfeignclients.slack.dto.SlackMessageRequestDto; | |
import cz.zpapez.springfeignclients.zephyr.ZephyrFeignClient; | |
import cz.zpapez.springfeignclients.zephyr.dto.ExecutionListResponseDto; | |
import lombok.RequiredArgsConstructor; | |
import lombok.extern.slf4j.Slf4j; | |
@Service | |
@RequiredArgsConstructor | |
@Slf4j | |
public class MyService { | |
private final ZephyrFeignClient zephyrClient; | |
private final SlackFeignClient slackClient; | |
public void fetchData() { | |
ExecutionListResponseDto executionsResponse = zephyrClient.getListOfExecutions("5112096"); | |
log.info("Found executions {}", executionsResponse.getExecutions()); | |
slackClient.postSlackMessage(new SlackMessageRequestDto("testing-channel", "test message to Slack")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment