-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from lotteon2/develop
release
- Loading branch information
Showing
12 changed files
with
170 additions
and
39 deletions.
There are no files selected for viewing
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
32 changes: 32 additions & 0 deletions
32
src/main/java/com/dailyon/auctionservice/chat/scheduler/AuctionActivationJob.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.dailyon.auctionservice.chat.scheduler; | ||
|
||
import com.dailyon.auctionservice.facade.BidFacade; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.quartz.Job; | ||
import org.quartz.JobDataMap; | ||
import org.quartz.JobExecutionContext; | ||
import org.quartz.SchedulerException; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
public class AuctionActivationJob implements Job { | ||
|
||
@Override | ||
public void execute(JobExecutionContext context) { | ||
// JobDataMap에서 auctionId 가져오기 | ||
JobDataMap jobDataMap = context.getJobDetail().getJobDataMap(); | ||
String auctionId = jobDataMap.getString("auctionId"); | ||
// auctionId를 사용하여 Job 실행 | ||
ApplicationContext applicationContext = null; | ||
try { | ||
applicationContext = | ||
(ApplicationContext) context.getScheduler().getContext().get("applicationContext"); | ||
} catch (SchedulerException e) { | ||
e.printStackTrace(); | ||
} | ||
BidFacade bidFacade = applicationContext.getBean(BidFacade.class); | ||
bidFacade.start(auctionId).subscribe(); | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
src/main/java/com/dailyon/auctionservice/config/AutowiringSpringBeanJobFactory.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.dailyon.auctionservice.config; | ||
|
||
import org.quartz.spi.TriggerFiredBundle; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.ApplicationContextAware; | ||
import org.springframework.scheduling.quartz.SpringBeanJobFactory; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory | ||
implements ApplicationContextAware { | ||
|
||
@Autowired private AutowireCapableBeanFactory beanFactory; | ||
|
||
@Override | ||
public void setApplicationContext(final ApplicationContext context) { | ||
beanFactory = context.getAutowireCapableBeanFactory(); | ||
} | ||
|
||
@Override | ||
protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception { | ||
final Object job = | ||
beanFactory.autowire( | ||
Class.forName(bundle.getJobDetail().getJobClass().getName()), | ||
AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, | ||
true); | ||
return job; | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
src/main/java/com/dailyon/auctionservice/config/SchedulerConfig.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.dailyon.auctionservice.config; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.quartz.SchedulerFactoryBean; | ||
|
||
@Configuration | ||
public class SchedulerConfig { | ||
|
||
@Autowired private ApplicationContext applicationContext; | ||
|
||
@Bean | ||
public SchedulerFactoryBean schedulerFactoryBean() { | ||
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean(); | ||
|
||
AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory(); | ||
jobFactory.setApplicationContext(applicationContext); | ||
schedulerFactoryBean.setApplicationContextSchedulerContextKey("applicationContext"); | ||
schedulerFactoryBean.setJobFactory(jobFactory); | ||
|
||
return schedulerFactoryBean; | ||
} | ||
} |
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
10 changes: 0 additions & 10 deletions
10
src/main/java/com/dailyon/auctionservice/dto/request/UserSession.java
This file was deleted.
Oops, something went wrong.
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
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
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
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