분류 전체보기
-
Spring Batch - Job Flow🌱 spring/🚛 spring batch 2022. 12. 16. 01:03
📌 Spring Batch Job Flow 실전에서 사용할 수 있는 Spring Batch 내용 Step 실제 Batch 작업을 수행하는 역할 Batch로 실제 처리하고자 하는 기능과 설정을 모두 포함하는 장소 Job 내부의 Step들 간의 순서 혹은 처리 흐름을 어떻게 제어❓ (Step 들을 어떻게 관리 ?) Next StepNextJobConfiguration.java 샘플코드 @Slf4j @Configuration @RequiredArgsConstructor public class StepNextJobConfiguration { private final JobBuilderFactory jobBuilderFactory; private final StepBuilderFactory stepBuilderF..
-
메타데이터 테이블🌱 spring/🚛 spring batch 2022. 12. 16. 00:53
📌 메타 테이블 알아보기 BATCH_JOB_INSTANCE BATCH_JOB_INSTANCE SELECT * FROM BATCH_JOB_INSTANCE; JOB_INSTANCE_ID : 테이블의 PK JOB_NAME : 수행한 Batch job name BATCH_JOB_INSTANCE 테이블은 Job Parameter에 따라 생성되는 테이블이다. Job Parameter ❓ Spring Batch 가 실행될 때 외부에서 받을 수 있는 파라미터 ex) 특정 날짜를 Job Parameter로 넘긴 경우 Spring Batch는 해당 날짜 데이터로 데이터를 조회 / 가공 / 입력 등의 작업을 할 수 있다. 같은 Batch Job 이라도 Job Parameter가 다르다면 BATCH_JOB_INSTANCE 에..
-
MySQL 환경 - Spring Batch🌱 spring/🚛 spring batch 2022. 12. 16. 00:47
📍 MySQL 환경에서 Spring Batch 실행 실제로 Spring Batch 는 어플리케이션 코드만 작성하면 되는 것이 아니다!! 메타 데이터 테이블 들이 필요하다 메타 데이터 데이터를 설명하는 데이터 데이터에 관한 구조화된 데이터로, 다른 데이터를 설명해 주는 데이터 Spring Batch의 메타데이터 이전에 실행한 Job이 어떤 것들이 있는지 최근 실패한 Batch Parameter에는 어떤 것들이 있는지 최근 성공한 Job은 어떤 것들이 있는지 다시 실행하면 어디서 부터 시작하면 될지 어떤 Job에 어떤 Step들이 있는지 Step들 중 성공한 Stpe과 실패한 Step들은 어떤 것들이 있는지 등등 Batch 어플리케이션을 운영하기 위한 메타데이터가 여러 테이블에 나눠져 있다. 메타 데이터의 ..
-
Spring Batch🌱 spring/🚛 spring batch 2022. 12. 16. 00:37
❓배치 어플리케이션 배치(Batch)는 일괄처리 라는 뜻을 가지고 있다. 매일 전 날의 데이터를 집계해야 한다고 가정 집계 과정을 어디서 수행해야 할까?? 웹 어플리케이션으로만 생각한다면 Tomcat + Spring MVC 를 생각한다. 하지만 이렇게 큰 데이터를 읽고 가공 후 저장한다면 해당 서버는 CPU, I/O 등의 자원을 다 써버려서 다른 Request 처리를 못하게 된다. 집계 기능은 하루에 1번 수행 이를 위해 API를 구성하는 것은 낭비 ❗ 데이터가 너무 많아 처리 중에 실패가 나는 경우? 실패한 위치부터 다시 실행할 수 있다면 얼마나 좋을까 이미 집계 함수를 누군가 실행했는데 다른 누군가 또 실행시켜서 데이터가 2배가 된다면? 같은 파라미터로 같은 함수를 실행할 경우 이미 실행한 적이 있다..
-
equals / hashCode☕️ java 2022. 12. 7. 18:06
equals ❓ hashCode ❓ equals와 hashCode는 모든 Java 객체의 부모 객체인 Object 클래스에 정의되어 있다. 따라서 Java의 모든 객체는 Object 클래스에 정의된 equals와 hashCode 함수를 상속받고 있다. equals() Object의 equals() public class Object { @IntrinsicCandidate public Object() {} ... public boolean equals(Object obj) { return (this == obj); } ... } 기본적으로 equals() 메소드는 2개의 객체가 동일한지 검사하기 위해 사용한다. 2개의 객체가 참조하는 것이 동일한지를 확인 - 동일성(Equality)을 비교하는 것 즉, 2..
-
Spring Interceptor에서 Request 데이터 처리🌱 spring 2022. 12. 6. 17:09
📍 HttpServletRequest - InputStream ‘application/json’ 타입의 데이터를 Servlet의 Filter 나 Spring의 Interceptor에서 따로 처리를 해주기 위해서는 HttpServletRequest의 InputStream 을 읽어야 한다. 인증 작업 등과 같은 상황에서 사용할 수 있다. ⚠️ 하지만 HttpServletRequest의 InputStream은 한 번 읽으면 다시 읽을 수 없다. 톰캣 개발자들이 막아 둠. Interceptor나 Filter에서 InputStream을 읽게 되면 이후 Spring이 Converter를 이용해 JSON 데이터를 바인딩 처리할 때 다음과 같은 에러가 발생한다. java.lang.IllegalStateException..
-
Hash Table 과 Hash Map💻 computer science/🧐 data structure 2022. 12. 4. 14:57
📍 Hash, Hash Function 해시(Hash) 데이터를 다루는 기법 중 하나 해시 함수 데이터를 효율적으로 관리하기 위해 임의의 길이의 데이터를 고정된 길이의 데이터로 매핑하는 함수 해시 함수 특징 같은 입력값에 대해서 같은 출력값이 보장된다. 서로 다른 입력값으로부터 동일한 출력값이 나올 가능성이 희박하므로 입력값에 대한 무결성이 보장된다. 일방향성을 갖는다. 📌 해시 테이블 (Hash Table) 키(key)와 값(value)이 하나의 쌍을 이루는 데이터 구조 즉, 키와 배열의 인덱스(index)를 이용하여 키를 저장하는 자료구조 해시 테이블은 해시 함수(hash function)으로 계산하여 그 값을 배열의 인덱스로 사용한다. 해시 함수로 의해 반환된 데이터의 고유 숫자 값을 해시 값 또는..
-
에러 로그 발생시 슬랙 알림 보내기공부방 2022. 11. 23. 14:48
💬 Slack 설정 워크 스페이스 생성 및 채널 생성 새로운 워크스페이스를 만들거나 기존의 워크스페이스 사용 에러 로그를 받을 새로운 채널 생성 채널 생성 후 우클릭 → View channel details 를 클릭해 상세 정보 페이지로 이동 Webhooks 추가 Integrations 항목에 들어가 App 을 추가 Github 앱을 통해서 commit 이나 pull request 등도 확인할 수 있다. Webhook App을 추가 슬랙을 통해 알림을 받을 예정이므로 Incoming Webhooks 을 install 추가 해둔 채널에 Incoming WebHooks integration을 추가한다. 추가를 하면 WebHook URL 과 사용 방법에 대한 안내를 해준다. Webhook 을 통한 알림 전송 ..