Revert "배치 주석 제거"
This reverts commit b3ff0c308aec1c4a22aad3ff65de900409d9e4cf.
This commit is contained in:
parent
b3ff0c308a
commit
ae88b2a95a
@ -14,6 +14,7 @@ import org.springframework.batch.core.configuration.annotation.StepScope;
|
|||||||
import org.springframework.batch.core.job.builder.JobBuilder;
|
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||||
import org.springframework.batch.core.repository.JobRepository;
|
import org.springframework.batch.core.repository.JobRepository;
|
||||||
import org.springframework.batch.core.step.builder.StepBuilder;
|
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||||
|
import org.springframework.batch.item.ItemReader;
|
||||||
import org.springframework.batch.item.ItemWriter;
|
import org.springframework.batch.item.ItemWriter;
|
||||||
import org.springframework.batch.item.support.ListItemReader;
|
import org.springframework.batch.item.support.ListItemReader;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -43,12 +44,16 @@ public class StoreJobConfiguration implements JobExecutionListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeJob(JobExecution jobExecution) {
|
public void beforeJob(JobExecution jobExecution) {
|
||||||
|
System.out.println("Job 시작: 초기화 메서드 호출 중...");
|
||||||
try {
|
try {
|
||||||
this.storeSyncResponse =
|
this.storeSyncResponse =
|
||||||
interfaceQsp.callApiData(
|
interfaceQsp.callApiData(
|
||||||
HttpMethod.GET, qspMasterStoreBatchUrl, null, StoreSyncResponse.class);
|
HttpMethod.GET, qspMasterStoreBatchUrl, null, StoreSyncResponse.class);
|
||||||
|
System.out.println(
|
||||||
|
"API 호출을 통해 storeSyncResponse 갱신 완료, 항목 수: "
|
||||||
|
+ this.storeSyncResponse.getStoreList().size());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("storeSyncResponse beforeJob 오류 발생: " + e.getMessage());
|
System.err.println("storeSyncResponse를 갱신하는 중 오류 발생: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +99,8 @@ public class StoreJobConfiguration implements JobExecutionListener {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@StepScope
|
@StepScope
|
||||||
public ListItemReader<StoreRequest> storeListReader() {
|
public ItemReader<StoreRequest> storeListReader() {
|
||||||
|
System.out.println("storeListReader 호출됨...");
|
||||||
return (storeSyncResponse != null && storeSyncResponse.getStoreList() != null)
|
return (storeSyncResponse != null && storeSyncResponse.getStoreList() != null)
|
||||||
? new ListItemReader<>(storeSyncResponse.getStoreList())
|
? new ListItemReader<>(storeSyncResponse.getStoreList())
|
||||||
: new ListItemReader<>(Collections.emptyList());
|
: new ListItemReader<>(Collections.emptyList());
|
||||||
@ -102,7 +108,8 @@ public class StoreJobConfiguration implements JobExecutionListener {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@StepScope
|
@StepScope
|
||||||
public ListItemReader<UserRequest> userListReader() {
|
public ItemReader<UserRequest> userListReader() {
|
||||||
|
System.out.println("userListReader 호출됨...");
|
||||||
return (storeSyncResponse != null && storeSyncResponse.getUserList() != null)
|
return (storeSyncResponse != null && storeSyncResponse.getUserList() != null)
|
||||||
? new ListItemReader<>(storeSyncResponse.getUserList())
|
? new ListItemReader<>(storeSyncResponse.getUserList())
|
||||||
: new ListItemReader<>(Collections.emptyList());
|
: new ListItemReader<>(Collections.emptyList());
|
||||||
@ -110,7 +117,8 @@ public class StoreJobConfiguration implements JobExecutionListener {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@StepScope
|
@StepScope
|
||||||
public ListItemReader<StoreFavoriteRequest> storeFavListReader() {
|
public ItemReader<StoreFavoriteRequest> storeFavListReader() {
|
||||||
|
System.out.println("storeFavListReader 호출됨...");
|
||||||
return (storeSyncResponse != null && storeSyncResponse.getStoreFavList() != null)
|
return (storeSyncResponse != null && storeSyncResponse.getStoreFavList() != null)
|
||||||
? new ListItemReader<>(storeSyncResponse.getStoreFavList())
|
? new ListItemReader<>(storeSyncResponse.getStoreFavList())
|
||||||
: new ListItemReader<>(Collections.emptyList());
|
: new ListItemReader<>(Collections.emptyList());
|
||||||
@ -119,25 +127,41 @@ public class StoreJobConfiguration implements JobExecutionListener {
|
|||||||
@Bean
|
@Bean
|
||||||
public ItemWriter<StoreRequest> storeWriter() {
|
public ItemWriter<StoreRequest> storeWriter() {
|
||||||
return items -> {
|
return items -> {
|
||||||
List<StoreRequest> storeRequestList =
|
try {
|
||||||
(List<StoreRequest>) items.getItems(); // Chunk에서 List로 추출
|
List<StoreRequest> storeRequestList =
|
||||||
userService.setStoreBatch(storeRequestList); // 서비스에 List를 한 번에 전달
|
(List<StoreRequest>) items.getItems(); // Chunk에서 List로 추출
|
||||||
|
userService.setStoreBatch(storeRequestList); // 서비스에 List를 한 번에 전달
|
||||||
|
System.out.println("storeWriter: " + items.size() + " items 처리 완료");
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("storeWriter 오류: " + e.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ItemWriter<UserRequest> userWriter() {
|
public ItemWriter<UserRequest> userWriter() {
|
||||||
return items -> {
|
return items -> {
|
||||||
List<UserRequest> userRequestList = (List<UserRequest>) items.getItems();
|
try {
|
||||||
userService.setUserBatch(userRequestList);
|
List<UserRequest> userRequestList = (List<UserRequest>) items.getItems();
|
||||||
|
userService.setUserBatch(userRequestList);
|
||||||
|
System.out.println("userWriter: " + items.size() + " items 처리 완료");
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("userWriter 오류: " + e.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ItemWriter<StoreFavoriteRequest> favoriteWriter() {
|
public ItemWriter<StoreFavoriteRequest> favoriteWriter() {
|
||||||
return items -> {
|
return items -> {
|
||||||
List<StoreFavoriteRequest> storeFavoriteList = (List<StoreFavoriteRequest>) items.getItems();
|
try {
|
||||||
storeFavService.setStoreFavoriteBatch(storeFavoriteList);
|
List<StoreFavoriteRequest> storeFavoriteList =
|
||||||
|
(List<StoreFavoriteRequest>) items.getItems();
|
||||||
|
storeFavService.setStoreFavoriteBatch(storeFavoriteList);
|
||||||
|
System.out.println("favoriteWriter: " + items.size() + " items 처리 완료");
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("favoriteWriter 오류: " + e.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user