Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat(batch): recommend music based on real time weather #472

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

siyeonSon
Copy link
Member

@siyeonSon siyeonSon self-assigned this May 9, 2024
@siyeonSon siyeonSon added ✨feature New feature or request 🏃🏽Batch Server Batch Domain labels May 9, 2024
@RequestParam("base_date") String baseDate,
@RequestParam("base_time") String baseTime,
@RequestParam("nx") int nx,
@RequestParam("ny") int ny);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

파라미터가 많아서 @RequestParam보다는 객체나 @RequestBody로 받는 것은 어떨까요? 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open API로 요청을 보내는 부분이에요!
정해진 규칙대로 사용해야 해서 수정은 불가능 할 것 같습니다.

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "openApiFeignClient", url = "${open-api.base-url}", configuration = FeignConfig.class)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 MVC나 Webflux가 아니라 Feign을 쓰신 이유가 있으신지 궁금합니다! 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

외부 API와 통신하는 방법으로 5가지 정도 고민했어요.

  • RestTemplate, WebClient, RestClient, HttpInterface, OpenFeign

성능을 결정하는 요인은 외부 API의 속도라고 생각해서 어떤 기술을 쓰든 성능은 비슷할 것이라 생각했어요.
가장 기술적으로 도전적이고, 경험해 보지 않은 기술이며, 코드 상으로 가독성 있고, 확장성 있는 기술을 채택하고 싶었습니다.
그 중 OpenFeign이 어노테이션 기반으로 가독성 있게 작성할 수 있어서 마음에 들었고, interface 형식으로 작성하기 때문에 확장성도 좋다고 느껴서 채택했습니다!


private final RealTimeWeatherJob realTimeWeatherJob;

@Scheduled(cron = "0 0 */3 * * *")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

소스코드에 cron 시간을 설정하면 나중에 시간을 변경하고 싶을때 소스코드 변경 및 애플리케이션 재배포가
필요해서 rundeck 같은 오픈소스나 aws event trigger 같은 거 다같이 논의해서 써보면 어떨까여? 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

외부에서 변경을 할 수 있군요 👀
안건 올려두겠습니다. 다음 회의 때 논의해 보아요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏃🏽Batch Server Batch Domain ✨feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Batch] weather based music recommendation
2 participants