큐설정, 통신 규격, 배치 수정
@e857310b624967a232aedaf4f7ffc30184a2f540
--- src/main/java/com/munjaon/server/cache/dto/MemberDto.java
+++ src/main/java/com/munjaon/server/cache/dto/MemberDto.java
... | ... | @@ -9,9 +9,8 @@ |
| 9 | 9 |
@ToString |
| 10 | 10 |
public class MemberDto {
|
| 11 | 11 |
private String mberId; |
| 12 |
- private String esntlId; |
|
| 12 |
+ private String accessKey; |
|
| 13 | 13 |
private String mberSttus; |
| 14 |
- private String dept; |
|
| 15 | 14 |
private float shortPrice; |
| 16 | 15 |
private float longPrice; |
| 17 | 16 |
private float picturePrice; |
... | ... | @@ -21,6 +20,23 @@ |
| 21 | 20 |
private float kakaoFtPrice; |
| 22 | 21 |
private float kakaoFtImgPrice; |
| 23 | 22 |
private float kakaoFtWideImgPrice; |
| 24 |
- private float faxPrice; |
|
| 25 |
- private float userMoney; |
|
| 23 |
+ |
|
| 24 |
+ private String smsUseYn; |
|
| 25 |
+ private String lmsUseYn; |
|
| 26 |
+ private String mmsUseYn; |
|
| 27 |
+ private String kakaoAtUseYn; |
|
| 28 |
+ private String kakaoFtUseYn; |
|
| 29 |
+ private int smsLimitCount; |
|
| 30 |
+ private int lmsLimitCount; |
|
| 31 |
+ private int mmsLimitCount; |
|
| 32 |
+ private int kakaoAtLimitCount; |
|
| 33 |
+ private int kakaoFtLimitCount; |
|
| 34 |
+ private String smsAgentCode; |
|
| 35 |
+ private String lmsAgentCode; |
|
| 36 |
+ private String mmsAgentCode; |
|
| 37 |
+ private String kakaoAtAgentCode; |
|
| 38 |
+ private String kakaoFtAgentCode; |
|
| 39 |
+ private String ipLimitYn; |
|
| 40 |
+ private String allowIpBasic; |
|
| 41 |
+ private String allowIpExtend; |
|
| 26 | 42 |
} |
--- src/main/java/com/munjaon/server/cache/mapper/MemberMapper.java
+++ src/main/java/com/munjaon/server/cache/mapper/MemberMapper.java
... | ... | @@ -11,7 +11,8 @@ |
| 11 | 11 |
* 회원테이블 마지막으로 변경된 시간 조회 |
| 12 | 12 |
* @return |
| 13 | 13 |
*/ |
| 14 |
- String getLastModifiedTime(String tableSchema); |
|
| 14 |
+ String getMemberLastModifiedTime(String tableSchema); |
|
| 15 |
+ String getConfigLastModifiedTime(String tableSchema); |
|
| 15 | 16 |
|
| 16 | 17 |
/** |
| 17 | 18 |
* 회원 전체 목록 |
--- src/main/java/com/munjaon/server/cache/service/MemberService.java
+++ src/main/java/com/munjaon/server/cache/service/MemberService.java
... | ... | @@ -21,8 +21,12 @@ |
| 21 | 21 |
* 회원테이블 마지막으로 변경된 시간 조회 |
| 22 | 22 |
* @return |
| 23 | 23 |
*/ |
| 24 |
- public String getLastModifiedTime(String tableSchema) {
|
|
| 25 |
- return memberMapper.getLastModifiedTime(tableSchema); |
|
| 24 |
+ public String getMemberLastModifiedTime(String tableSchema) {
|
|
| 25 |
+ return memberMapper.getMemberLastModifiedTime(tableSchema); |
|
| 26 |
+ } |
|
| 27 |
+ |
|
| 28 |
+ public String getConfigLastModifiedTime(String tableSchema) {
|
|
| 29 |
+ return memberMapper.getConfigLastModifiedTime(tableSchema); |
|
| 26 | 30 |
} |
| 27 | 31 |
|
| 28 | 32 |
/** |
--- src/main/java/com/munjaon/server/config/RunnerConfiguration.java
+++ src/main/java/com/munjaon/server/config/RunnerConfiguration.java
... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 |
@Order(1) |
| 18 | 18 |
public CommandLineRunner getRunnerBeanForProperty() {
|
| 19 | 19 |
System.setProperty("PROPS", serverConfig.getServerProperyFile());
|
| 20 |
+ System.setProperty("ROOTPATH", serverConfig.getServerRootPath());
|
|
| 20 | 21 |
PropertyLoader.load(); |
| 21 | 22 |
try {
|
| 22 | 23 |
String[] array = serverConfig.getStringArray("test.list");
|
--- src/main/java/com/munjaon/server/config/ServerConfig.java
+++ src/main/java/com/munjaon/server/config/ServerConfig.java
... | ... | @@ -24,6 +24,10 @@ |
| 24 | 24 |
@Value("${agent.server-property-file}")
|
| 25 | 25 |
private String serverProperyFile; |
| 26 | 26 |
|
| 27 |
+ @Getter |
|
| 28 |
+ @Value("${agent.root-path}")
|
|
| 29 |
+ private String serverRootPath; |
|
| 30 |
+ |
|
| 27 | 31 |
private ReloadingFileBasedConfigurationBuilder<PropertiesConfiguration> builder; |
| 28 | 32 |
|
| 29 | 33 |
@PostConstruct |
--- src/main/java/com/munjaon/server/queue/dto/QueueInfo.java
+++ src/main/java/com/munjaon/server/queue/dto/QueueInfo.java
... | ... | @@ -12,7 +12,8 @@ |
| 12 | 12 |
public class QueueInfo {
|
| 13 | 13 |
private String queueName = ""; |
| 14 | 14 |
private String queueFileName = ""; |
| 15 |
- private int queueDataLength = 0; |
|
| 15 |
+// private int queueDataLength = 0; |
|
| 16 | 16 |
private String serviceType = ""; |
| 17 | 17 |
private String readXMLFileName = ""; |
| 18 |
+ private boolean isRun; |
|
| 18 | 19 |
} |
--- src/main/java/com/munjaon/server/queue/enums/QueueService.java
+++ src/main/java/com/munjaon/server/queue/enums/QueueService.java
... | ... | @@ -4,10 +4,11 @@ |
| 4 | 4 |
|
| 5 | 5 |
@Getter |
| 6 | 6 |
public enum QueueService {
|
| 7 |
- SMS_QUEUE, |
|
| 8 |
- LMS_QUEUE, |
|
| 9 |
- MMS_QUEUE, |
|
| 10 |
- KAKAO_QUEUE; |
|
| 7 |
+ SMS_QUEUE_SERVICE, |
|
| 8 |
+ LMS_QUEUE_SERVICE, |
|
| 9 |
+ MMS_QUEUE_SERVICE, |
|
| 10 |
+ KAT_QUEUE_SERVICE, |
|
| 11 |
+ KFT_QUEUE_SERVICE; |
|
| 11 | 12 |
|
| 12 | 13 |
private Object service; |
| 13 | 14 |
|
+++ src/main/java/com/munjaon/server/queue/enums/QueueTypeWorker.java
... | ... | @@ -0,0 +1,189 @@ |
| 1 | +package com.munjaon.server.queue.enums; | |
| 2 | + | |
| 3 | +import com.munjaon.server.queue.dto.BasicMessageDto; | |
| 4 | +import com.munjaon.server.queue.pool.WriteQueue; | |
| 5 | +import com.munjaon.server.queue.service.*; | |
| 6 | +import lombok.Getter; | |
| 7 | + | |
| 8 | +import java.util.EnumSet; | |
| 9 | + | |
| 10 | +@Getter | |
| 11 | +public enum QueueTypeWorker { | |
| 12 | + MSG_TYPE_SMS("SMS") { | |
| 13 | + @Override | |
| 14 | + public boolean isExistQueue(String name) { | |
| 15 | + SmsQueueService smsQueueService = (SmsQueueService) QueueService.SMS_QUEUE_SERVICE.getService(); | |
| 16 | + return smsQueueService.isExistQueue(name); | |
| 17 | + } | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public void removeQueue(String name) { | |
| 21 | + SmsQueueService smsQueueService = (SmsQueueService) QueueService.SMS_QUEUE_SERVICE.getService(); | |
| 22 | + smsQueueService.removeQueue(name); | |
| 23 | + } | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + public void addQueue(WriteQueue queue) { | |
| 27 | + SmsQueueService smsQueueService = (SmsQueueService) QueueService.SMS_QUEUE_SERVICE.getService(); | |
| 28 | + smsQueueService.addQueue(queue); | |
| 29 | + } | |
| 30 | + | |
| 31 | + @Override | |
| 32 | + public void pushQueue(BasicMessageDto data) { | |
| 33 | + SmsQueueService smsQueueService = (SmsQueueService) QueueService.SMS_QUEUE_SERVICE.getService(); | |
| 34 | + smsQueueService.pushQueue(data); | |
| 35 | + } | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public int saveMessageToTable(BasicMessageDto data) { | |
| 39 | + SmsQueueService smsQueueService = (SmsQueueService) QueueService.SMS_QUEUE_SERVICE.getService(); | |
| 40 | + return smsQueueService.saveMessageToTable(data); | |
| 41 | + } | |
| 42 | + }, | |
| 43 | + MSG_TYPE_LMS("LMS") { | |
| 44 | + @Override | |
| 45 | + public boolean isExistQueue(String name) { | |
| 46 | + LmsQueueService lmsQueueService = (LmsQueueService) QueueService.LMS_QUEUE_SERVICE.getService(); | |
| 47 | + return lmsQueueService.isExistQueue(name); | |
| 48 | + } | |
| 49 | + | |
| 50 | + @Override | |
| 51 | + public void removeQueue(String name) { | |
| 52 | + LmsQueueService lmsQueueService = (LmsQueueService) QueueService.LMS_QUEUE_SERVICE.getService(); | |
| 53 | + lmsQueueService.removeQueue(name); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Override | |
| 57 | + public void addQueue(WriteQueue queue) { | |
| 58 | + LmsQueueService lmsQueueService = (LmsQueueService) QueueService.LMS_QUEUE_SERVICE.getService(); | |
| 59 | + lmsQueueService.addQueue(queue); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public void pushQueue(BasicMessageDto data) { | |
| 64 | + LmsQueueService lmsQueueService = (LmsQueueService) QueueService.LMS_QUEUE_SERVICE.getService(); | |
| 65 | + lmsQueueService.pushQueue(data); | |
| 66 | + } | |
| 67 | + | |
| 68 | + @Override | |
| 69 | + public int saveMessageToTable(BasicMessageDto data) { | |
| 70 | + LmsQueueService lmsQueueService = (LmsQueueService) QueueService.LMS_QUEUE_SERVICE.getService(); | |
| 71 | + return lmsQueueService.saveMessageToTable(data); | |
| 72 | + } | |
| 73 | + }, | |
| 74 | + MSG_TYPE_MMS("MMS") { | |
| 75 | + @Override | |
| 76 | + public boolean isExistQueue(String name) { | |
| 77 | + MmsQueueService mmsQueueService = (MmsQueueService) QueueService.MMS_QUEUE_SERVICE.getService(); | |
| 78 | + return mmsQueueService.isExistQueue(name); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Override | |
| 82 | + public void removeQueue(String name) { | |
| 83 | + MmsQueueService mmsQueueService = (MmsQueueService) QueueService.MMS_QUEUE_SERVICE.getService(); | |
| 84 | + mmsQueueService.removeQueue(name); | |
| 85 | + } | |
| 86 | + | |
| 87 | + @Override | |
| 88 | + public void addQueue(WriteQueue queue) { | |
| 89 | + MmsQueueService mmsQueueService = (MmsQueueService) QueueService.MMS_QUEUE_SERVICE.getService(); | |
| 90 | + mmsQueueService.addQueue(queue); | |
| 91 | + } | |
| 92 | + | |
| 93 | + @Override | |
| 94 | + public void pushQueue(BasicMessageDto data) { | |
| 95 | + MmsQueueService mmsQueueService = (MmsQueueService) QueueService.MMS_QUEUE_SERVICE.getService(); | |
| 96 | + mmsQueueService.pushQueue(data); | |
| 97 | + } | |
| 98 | + | |
| 99 | + @Override | |
| 100 | + public int saveMessageToTable(BasicMessageDto data) { | |
| 101 | + MmsQueueService mmsQueueService = (MmsQueueService) QueueService.MMS_QUEUE_SERVICE.getService(); | |
| 102 | + return mmsQueueService.saveMessageToTable(data); | |
| 103 | + } | |
| 104 | + }, | |
| 105 | + MSG_TYPE_KAT("KAT") { | |
| 106 | + @Override | |
| 107 | + public boolean isExistQueue(String name) { | |
| 108 | + KakaoAlarmQueueService kakaoAlarmQueueService = (KakaoAlarmQueueService) QueueService.KAT_QUEUE_SERVICE.getService(); | |
| 109 | + return kakaoAlarmQueueService.isExistQueue(name); | |
| 110 | + } | |
| 111 | + | |
| 112 | + @Override | |
| 113 | + public void removeQueue(String name) { | |
| 114 | + KakaoAlarmQueueService kakaoAlarmQueueService = (KakaoAlarmQueueService) QueueService.KAT_QUEUE_SERVICE.getService(); | |
| 115 | + kakaoAlarmQueueService.removeQueue(name); | |
| 116 | + } | |
| 117 | + | |
| 118 | + @Override | |
| 119 | + public void addQueue(WriteQueue queue) { | |
| 120 | + KakaoAlarmQueueService kakaoAlarmQueueService = (KakaoAlarmQueueService) QueueService.KAT_QUEUE_SERVICE.getService(); | |
| 121 | + kakaoAlarmQueueService.addQueue(queue); | |
| 122 | + } | |
| 123 | + | |
| 124 | + @Override | |
| 125 | + public void pushQueue(BasicMessageDto data) { | |
| 126 | + KakaoAlarmQueueService kakaoAlarmQueueService = (KakaoAlarmQueueService) QueueService.KAT_QUEUE_SERVICE.getService(); | |
| 127 | + kakaoAlarmQueueService.pushQueue(data); | |
| 128 | + } | |
| 129 | + | |
| 130 | + @Override | |
| 131 | + public int saveMessageToTable(BasicMessageDto data) { | |
| 132 | + KakaoAlarmQueueService kakaoAlarmQueueService = (KakaoAlarmQueueService) QueueService.KAT_QUEUE_SERVICE.getService(); | |
| 133 | + return kakaoAlarmQueueService.saveMessageToTable(data); | |
| 134 | + } | |
| 135 | + }, | |
| 136 | + MSG_TYPE_KFT("KFT") { | |
| 137 | + @Override | |
| 138 | + public boolean isExistQueue(String name) { | |
| 139 | + KakaoFriendQueueService kakaoFriendQueueService = (KakaoFriendQueueService) QueueService.KFT_QUEUE_SERVICE.getService(); | |
| 140 | + return kakaoFriendQueueService.isExistQueue(name); | |
| 141 | + } | |
| 142 | + | |
| 143 | + @Override | |
| 144 | + public void removeQueue(String name) { | |
| 145 | + KakaoFriendQueueService kakaoFriendQueueService = (KakaoFriendQueueService) QueueService.KFT_QUEUE_SERVICE.getService(); | |
| 146 | + kakaoFriendQueueService.removeQueue(name); | |
| 147 | + } | |
| 148 | + | |
| 149 | + @Override | |
| 150 | + public void addQueue(WriteQueue queue) { | |
| 151 | + KakaoFriendQueueService kakaoFriendQueueService = (KakaoFriendQueueService) QueueService.KFT_QUEUE_SERVICE.getService(); | |
| 152 | + kakaoFriendQueueService.addQueue(queue); | |
| 153 | + } | |
| 154 | + | |
| 155 | + @Override | |
| 156 | + public void pushQueue(BasicMessageDto data) { | |
| 157 | + KakaoFriendQueueService kakaoFriendQueueService = (KakaoFriendQueueService) QueueService.KFT_QUEUE_SERVICE.getService(); | |
| 158 | + kakaoFriendQueueService.pushQueue(data); | |
| 159 | + } | |
| 160 | + | |
| 161 | + @Override | |
| 162 | + public int saveMessageToTable(BasicMessageDto data) { | |
| 163 | + KakaoFriendQueueService kakaoFriendQueueService = (KakaoFriendQueueService) QueueService.KFT_QUEUE_SERVICE.getService(); | |
| 164 | + return kakaoFriendQueueService.saveMessageToTable(data); | |
| 165 | + } | |
| 166 | + }; | |
| 167 | + | |
| 168 | + QueueTypeWorker(final String name) { | |
| 169 | + this.type = name; | |
| 170 | + } | |
| 171 | + | |
| 172 | + private final String type; | |
| 173 | + | |
| 174 | + public static QueueTypeWorker find(String type) { | |
| 175 | + for (QueueTypeWorker queueTypeWorker : EnumSet.allOf(QueueTypeWorker.class)) { | |
| 176 | + if (type.equals(queueTypeWorker.getType())) { | |
| 177 | + return queueTypeWorker; | |
| 178 | + } | |
| 179 | + } | |
| 180 | + | |
| 181 | + return null; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public abstract boolean isExistQueue(String name); | |
| 185 | + public abstract void removeQueue(String name); | |
| 186 | + public abstract void addQueue(WriteQueue queue); | |
| 187 | + public abstract void pushQueue(BasicMessageDto data); | |
| 188 | + public abstract int saveMessageToTable(BasicMessageDto data); | |
| 189 | +} |
+++ src/main/java/com/munjaon/server/queue/pool/KakaoAlarmQueuePool.java
... | ... | @@ -0,0 +1,15 @@ |
| 1 | +package com.munjaon.server.queue.pool; | |
| 2 | + | |
| 3 | +public class KakaoAlarmQueuePool extends QueuePool { | |
| 4 | + /** Singleton Instance */ | |
| 5 | + private static KakaoAlarmQueuePool queueInstance; | |
| 6 | + | |
| 7 | + private KakaoAlarmQueuePool() {} | |
| 8 | + | |
| 9 | + public synchronized static KakaoAlarmQueuePool getInstance(){ | |
| 10 | + if(queueInstance == null){ | |
| 11 | + queueInstance = new KakaoAlarmQueuePool(); | |
| 12 | + } | |
| 13 | + return queueInstance; | |
| 14 | + } | |
| 15 | +} |
--- src/main/java/com/munjaon/server/queue/service/KakaoWriteQueue.java
+++ src/main/java/com/munjaon/server/queue/pool/KakaoAlarmWriteQueue.java
... | ... | @@ -0,0 +1,21 @@ |
| 1 | +package com.munjaon.server.queue.pool; | |
| 2 | + | |
| 3 | +import com.munjaon.server.queue.dto.BasicMessageDto; | |
| 4 | + | |
| 5 | +public class KakaoAlarmWriteQueue extends WriteQueue { | |
| 6 | + | |
| 7 | + @Override | |
| 8 | + int isValidateMessageForExtend(BasicMessageDto messageDto) { | |
| 9 | + return 0; | |
| 10 | + } | |
| 11 | + | |
| 12 | + @Override | |
| 13 | + void pushMessageToBuffer(BasicMessageDto messageDto) throws Exception { | |
| 14 | + | |
| 15 | + } | |
| 16 | + | |
| 17 | + @Override | |
| 18 | + void initDataBuffer() { | |
| 19 | + | |
| 20 | + } | |
| 21 | +} |
+++ src/main/java/com/munjaon/server/queue/pool/KakaoFriendQueuePool.java
... | ... | @@ -0,0 +1,15 @@ |
| 1 | +package com.munjaon.server.queue.pool; | |
| 2 | + | |
| 3 | +public class KakaoFriendQueuePool extends QueuePool { | |
| 4 | + /** Singleton Instance */ | |
| 5 | + private static KakaoFriendQueuePool queueInstance; | |
| 6 | + | |
| 7 | + private KakaoFriendQueuePool() {} | |
| 8 | + | |
| 9 | + public synchronized static KakaoFriendQueuePool getInstance(){ | |
| 10 | + if(queueInstance == null){ | |
| 11 | + queueInstance = new KakaoFriendQueuePool(); | |
| 12 | + } | |
| 13 | + return queueInstance; | |
| 14 | + } | |
| 15 | +} |
--- src/main/java/com/munjaon/server/queue/service/KakaoWriteQueue.java
+++ src/main/java/com/munjaon/server/queue/pool/KakaoFriendWriteQueue.java
... | ... | @@ -1,11 +1,10 @@ |
| 1 |
-package com.munjaon.server.queue.service; |
|
| 1 |
+package com.munjaon.server.queue.pool; |
|
| 2 | 2 |
|
| 3 | 3 |
import com.munjaon.server.queue.dto.BasicMessageDto; |
| 4 | 4 |
|
| 5 |
-public class KakaoWriteQueue extends WriteQueue {
|
|
| 6 |
- |
|
| 5 |
+public class KakaoFriendWriteQueue extends WriteQueue {
|
|
| 7 | 6 |
@Override |
| 8 |
- int isisValidateMessageForExtend(BasicMessageDto messageDto) {
|
|
| 7 |
+ int isValidateMessageForExtend(BasicMessageDto messageDto) {
|
|
| 9 | 8 |
return 0; |
| 10 | 9 |
} |
| 11 | 10 |
|
--- src/main/java/com/munjaon/server/queue/pool/LmsQueuePool.java
+++ src/main/java/com/munjaon/server/queue/pool/LmsQueuePool.java
... | ... | @@ -1,84 +1,15 @@ |
| 1 | 1 |
package com.munjaon.server.queue.pool; |
| 2 | 2 |
|
| 3 |
-import com.munjaon.server.queue.dto.BasicMessageDto; |
|
| 4 |
-import com.munjaon.server.queue.service.LmsWriteQueue; |
|
| 5 |
- |
|
| 6 |
-import java.util.LinkedList; |
|
| 7 |
- |
|
| 8 |
-public class LmsQueuePool {
|
|
| 9 |
- /** Lock Object */ |
|
| 10 |
- private final Object lockMonitor = new Object(); |
|
| 11 |
- /** File Queue Pool */ |
|
| 12 |
- private final LinkedList<LmsWriteQueue> queuePool = new LinkedList<>(); |
|
| 13 |
- /** File Queue */ |
|
| 14 |
- private LmsWriteQueue queue = null; |
|
| 15 |
- /** File Queue 분배를 위한 인덱서 */ |
|
| 16 |
- private int queueIndex = 0; |
|
| 17 |
- |
|
| 3 |
+public class LmsQueuePool extends QueuePool {
|
|
| 18 | 4 |
/** Singleton Instance */ |
| 19 |
- private static SmsQueuePool fileQueue; |
|
| 5 |
+ private static LmsQueuePool queueInstance; |
|
| 20 | 6 |
|
| 21 |
- public synchronized static SmsQueuePool getInstance(){
|
|
| 22 |
- if(fileQueue == null){
|
|
| 23 |
- fileQueue = new SmsQueuePool(); |
|
| 24 |
- } |
|
| 25 |
- return fileQueue; |
|
| 26 |
- } |
|
| 7 |
+ private LmsQueuePool() {}
|
|
| 27 | 8 |
|
| 28 |
- /** Queue 존재하는지 조회 */ |
|
| 29 |
- public boolean isExistQueue(String name){
|
|
| 30 |
- synchronized(lockMonitor){
|
|
| 31 |
- boolean isExist = false; |
|
| 32 |
- for (LmsWriteQueue writeQueue : queuePool) {
|
|
| 33 |
- if (name.equals(writeQueue.getQueueName())) {
|
|
| 34 |
- isExist = true; |
|
| 35 |
- break; |
|
| 36 |
- } |
|
| 37 |
- } |
|
| 38 |
- return isExist; |
|
| 9 |
+ public synchronized static LmsQueuePool getInstance(){
|
|
| 10 |
+ if(queueInstance == null){
|
|
| 11 |
+ queueInstance = new LmsQueuePool(); |
|
| 39 | 12 |
} |
| 40 |
- } |
|
| 41 |
- /** Queue 제거 */ |
|
| 42 |
- public void removeQueue(String name){
|
|
| 43 |
- synchronized(lockMonitor) {
|
|
| 44 |
- for (int loopCnt = 0; loopCnt < queuePool.size(); loopCnt++) {
|
|
| 45 |
- queue = queuePool.get(loopCnt); |
|
| 46 |
- if(name.equals(queue.getQueueName())){
|
|
| 47 |
- queuePool.remove(loopCnt); |
|
| 48 |
- System.out.println("[LMS Queue] [" + queue.getQueueName() + " is Removed]");
|
|
| 49 |
- break; |
|
| 50 |
- } |
|
| 51 |
- } |
|
| 52 |
- } |
|
| 53 |
- } |
|
| 54 |
- /** Queue 등록 */ |
|
| 55 |
- public void addShortQueue(LmsWriteQueue queue){
|
|
| 56 |
- synchronized(lockMonitor){
|
|
| 57 |
- if (queue != null){
|
|
| 58 |
- queuePool.addLast(queue); |
|
| 59 |
- lockMonitor.notifyAll(); |
|
| 60 |
- } |
|
| 61 |
- } |
|
| 62 |
- } |
|
| 63 |
- /** Queue 데이터 저장 */ |
|
| 64 |
- public void pushQueue(BasicMessageDto data) throws Exception{
|
|
| 65 |
- synchronized(lockMonitor) {
|
|
| 66 |
- if (queuePool.isEmpty()) {
|
|
| 67 |
- try{
|
|
| 68 |
- lockMonitor.wait(); |
|
| 69 |
- }catch(InterruptedException e){
|
|
| 70 |
- // 아무 처리도 하지 않는다. |
|
| 71 |
- } |
|
| 72 |
- } |
|
| 73 |
- //큐리스트의 끝까지 이동한 경우 처음으로 되돌린다. |
|
| 74 |
- if (queueIndex >= queuePool.size()) {
|
|
| 75 |
- queueIndex = 0; |
|
| 76 |
- } |
|
| 77 |
- // 파일큐에 Push 한다. |
|
| 78 |
- queue = queuePool.get(queueIndex); |
|
| 79 |
- queue.pushMessageToBuffer(data); |
|
| 80 |
- // 큐인덱서를 증가시킨다. |
|
| 81 |
- queueIndex++; |
|
| 82 |
- } |
|
| 13 |
+ return queueInstance; |
|
| 83 | 14 |
} |
| 84 | 15 |
} |
--- src/main/java/com/munjaon/server/queue/service/LmsWriteQueue.java
+++ src/main/java/com/munjaon/server/queue/pool/LmsWriteQueue.java
... | ... | @@ -1,4 +1,4 @@ |
| 1 |
-package com.munjaon.server.queue.service; |
|
| 1 |
+package com.munjaon.server.queue.pool; |
|
| 2 | 2 |
|
| 3 | 3 |
import com.munjaon.server.config.ServiceCode; |
| 4 | 4 |
import com.munjaon.server.queue.config.MediaBodyConfig; |
... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 |
public class LmsWriteQueue extends WriteQueue {
|
| 12 | 12 |
|
| 13 | 13 |
@Override |
| 14 |
- public int isisValidateMessageForExtend(BasicMessageDto messageDto) {
|
|
| 14 |
+ public int isValidateMessageForExtend(BasicMessageDto messageDto) {
|
|
| 15 | 15 |
/* 13. 제목 */ |
| 16 | 16 |
if (MessageUtil.isEmptyForMessage(messageDto.getUserSubject(), true) || MessageUtil.isOverByteForMessage(messageDto.getUserSubject(), MediaBodyConfig.SUBJECT_BYTE_LENGTH, false)) {
|
| 17 | 17 |
return ServiceCode.MSG_ERROR_MEDIA_SUBJECT.getCode(); |
--- src/main/java/com/munjaon/server/queue/pool/MmsQueuePool.java
+++ src/main/java/com/munjaon/server/queue/pool/MmsQueuePool.java
... | ... | @@ -1,84 +1,15 @@ |
| 1 | 1 |
package com.munjaon.server.queue.pool; |
| 2 | 2 |
|
| 3 |
-import com.munjaon.server.queue.dto.BasicMessageDto; |
|
| 4 |
-import com.munjaon.server.queue.service.MmsWriteQueue; |
|
| 5 |
- |
|
| 6 |
-import java.util.LinkedList; |
|
| 7 |
- |
|
| 8 |
-public class MmsQueuePool {
|
|
| 9 |
- /** Lock Object */ |
|
| 10 |
- private final Object lockMonitor = new Object(); |
|
| 11 |
- /** File Queue Pool */ |
|
| 12 |
- private final LinkedList<MmsWriteQueue> queuePool = new LinkedList<>(); |
|
| 13 |
- /** File Queue */ |
|
| 14 |
- private MmsWriteQueue queue = null; |
|
| 15 |
- /** File Queue 분배를 위한 인덱서 */ |
|
| 16 |
- private int queueIndex = 0; |
|
| 17 |
- |
|
| 3 |
+public class MmsQueuePool extends QueuePool {
|
|
| 18 | 4 |
/** Singleton Instance */ |
| 19 |
- private static SmsQueuePool fileQueue; |
|
| 5 |
+ private static MmsQueuePool queueInstance; |
|
| 20 | 6 |
|
| 21 |
- public synchronized static SmsQueuePool getInstance(){
|
|
| 22 |
- if(fileQueue == null){
|
|
| 23 |
- fileQueue = new SmsQueuePool(); |
|
| 24 |
- } |
|
| 25 |
- return fileQueue; |
|
| 26 |
- } |
|
| 7 |
+ private MmsQueuePool() {}
|
|
| 27 | 8 |
|
| 28 |
- /** Queue 존재하는지 조회 */ |
|
| 29 |
- public boolean isExistQueue(String name){
|
|
| 30 |
- synchronized(lockMonitor){
|
|
| 31 |
- boolean isExist = false; |
|
| 32 |
- for (MmsWriteQueue writeQueue : queuePool) {
|
|
| 33 |
- if (name.equals(writeQueue.getQueueName())) {
|
|
| 34 |
- isExist = true; |
|
| 35 |
- break; |
|
| 36 |
- } |
|
| 37 |
- } |
|
| 38 |
- return isExist; |
|
| 9 |
+ public synchronized static MmsQueuePool getInstance(){
|
|
| 10 |
+ if(queueInstance == null){
|
|
| 11 |
+ queueInstance = new MmsQueuePool(); |
|
| 39 | 12 |
} |
| 40 |
- } |
|
| 41 |
- /** Queue 제거 */ |
|
| 42 |
- public void removeQueue(String name){
|
|
| 43 |
- synchronized(lockMonitor) {
|
|
| 44 |
- for (int loopCnt = 0; loopCnt < queuePool.size(); loopCnt++) {
|
|
| 45 |
- queue = queuePool.get(loopCnt); |
|
| 46 |
- if(name.equals(queue.getQueueName())){
|
|
| 47 |
- queuePool.remove(loopCnt); |
|
| 48 |
- System.out.println("[MMS Queue] [" + queue.getQueueName() + " is Removed]");
|
|
| 49 |
- break; |
|
| 50 |
- } |
|
| 51 |
- } |
|
| 52 |
- } |
|
| 53 |
- } |
|
| 54 |
- /** Queue 등록 */ |
|
| 55 |
- public void addShortQueue(MmsWriteQueue queue){
|
|
| 56 |
- synchronized(lockMonitor){
|
|
| 57 |
- if (queue != null){
|
|
| 58 |
- queuePool.addLast(queue); |
|
| 59 |
- lockMonitor.notifyAll(); |
|
| 60 |
- } |
|
| 61 |
- } |
|
| 62 |
- } |
|
| 63 |
- /** Queue 데이터 저장 */ |
|
| 64 |
- public void pushQueue(BasicMessageDto data) throws Exception{
|
|
| 65 |
- synchronized(lockMonitor) {
|
|
| 66 |
- if (queuePool.isEmpty()) {
|
|
| 67 |
- try{
|
|
| 68 |
- lockMonitor.wait(); |
|
| 69 |
- } catch (InterruptedException e) {
|
|
| 70 |
- // 아무 처리도 하지 않는다. |
|
| 71 |
- } |
|
| 72 |
- } |
|
| 73 |
- //큐리스트의 끝까지 이동한 경우 처음으로 되돌린다. |
|
| 74 |
- if (queueIndex >= queuePool.size()) {
|
|
| 75 |
- queueIndex = 0; |
|
| 76 |
- } |
|
| 77 |
- // 파일큐에 Push 한다. |
|
| 78 |
- queue = queuePool.get(queueIndex); |
|
| 79 |
- queue.pushMessageToBuffer(data); |
|
| 80 |
- // 큐인덱서를 증가시킨다. |
|
| 81 |
- queueIndex++; |
|
| 82 |
- } |
|
| 13 |
+ return queueInstance; |
|
| 83 | 14 |
} |
| 84 | 15 |
} |
--- src/main/java/com/munjaon/server/queue/service/MmsWriteQueue.java
+++ src/main/java/com/munjaon/server/queue/pool/MmsWriteQueue.java
... | ... | @@ -1,4 +1,4 @@ |
| 1 |
-package com.munjaon.server.queue.service; |
|
| 1 |
+package com.munjaon.server.queue.pool; |
|
| 2 | 2 |
|
| 3 | 3 |
import com.munjaon.server.config.ServiceCode; |
| 4 | 4 |
import com.munjaon.server.queue.config.MediaBodyConfig; |
... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 |
public class MmsWriteQueue extends WriteQueue {
|
| 12 | 12 |
|
| 13 | 13 |
@Override |
| 14 |
- public int isisValidateMessageForExtend(BasicMessageDto messageDto) {
|
|
| 14 |
+ public int isValidateMessageForExtend(BasicMessageDto messageDto) {
|
|
| 15 | 15 |
/* 13. 제목 */ |
| 16 | 16 |
if (MessageUtil.isEmptyForMessage(messageDto.getUserSubject(), true) || MessageUtil.isOverByteForMessage(messageDto.getUserSubject(), MediaBodyConfig.SUBJECT_BYTE_LENGTH, false)) {
|
| 17 | 17 |
return ServiceCode.MSG_ERROR_MEDIA_SUBJECT.getCode(); |
+++ src/main/java/com/munjaon/server/queue/pool/QueuePool.java
... | ... | @@ -0,0 +1,77 @@ |
| 1 | +package com.munjaon.server.queue.pool; | |
| 2 | + | |
| 3 | +import com.munjaon.server.queue.dto.BasicMessageDto; | |
| 4 | + | |
| 5 | +import java.util.LinkedList; | |
| 6 | + | |
| 7 | +public abstract class QueuePool { | |
| 8 | + /** Lock Object */ | |
| 9 | + protected final Object lockMonitor = new Object(); | |
| 10 | + /** File Queue Pool */ | |
| 11 | + protected final LinkedList<WriteQueue> queuePool = new LinkedList<>(); | |
| 12 | + /** File Queue */ | |
| 13 | + protected WriteQueue queue = null; | |
| 14 | + /** File Queue 분배를 위한 인덱서 */ | |
| 15 | + protected int queueIndex = 0; | |
| 16 | + | |
| 17 | + /** Queue 존재하는지 조회 */ | |
| 18 | + public boolean isExistQueue(String name){ | |
| 19 | + synchronized (lockMonitor) { | |
| 20 | + boolean isExist = false; | |
| 21 | + for (WriteQueue writeQueue : queuePool) { | |
| 22 | + if (name.equals(writeQueue.getQueueName())) { | |
| 23 | + isExist = true; | |
| 24 | + break; | |
| 25 | + } | |
| 26 | + } | |
| 27 | + | |
| 28 | + return isExist; | |
| 29 | + } | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** Queue 제거 */ | |
| 33 | + public void removeQueue(String name) { | |
| 34 | + synchronized (lockMonitor) { | |
| 35 | + for (int loopCnt = 0; loopCnt < queuePool.size(); loopCnt++) { | |
| 36 | + queue = queuePool.get(loopCnt); | |
| 37 | + if(name.equals(queue.getQueueName())){ | |
| 38 | + queuePool.remove(loopCnt); | |
| 39 | + System.out.println("[" + queue.getQueueInfo().getServiceType() + " Queue] [" + queue.getQueueName() + " is Removed]"); | |
| 40 | + break; | |
| 41 | + } | |
| 42 | + } | |
| 43 | + } | |
| 44 | + } | |
| 45 | + | |
| 46 | + /** Queue 등록 */ | |
| 47 | + public void addQueue(WriteQueue queue) { | |
| 48 | + synchronized(lockMonitor){ | |
| 49 | + if (queue != null){ | |
| 50 | + queuePool.addLast(queue); | |
| 51 | + lockMonitor.notifyAll(); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** Queue 데이터 저장 */ | |
| 57 | + public void pushQueue(BasicMessageDto data) throws Exception { | |
| 58 | + synchronized(lockMonitor) { | |
| 59 | + if (queuePool.isEmpty()) { | |
| 60 | + try{ | |
| 61 | + lockMonitor.wait(); | |
| 62 | + }catch(InterruptedException e){ | |
| 63 | + // 아무 처리도 하지 않는다. | |
| 64 | + } | |
| 65 | + } | |
| 66 | + //큐리스트의 끝까지 이동한 경우 처음으로 되돌린다. | |
| 67 | + if (queueIndex >= queuePool.size()) { | |
| 68 | + queueIndex = 0; | |
| 69 | + } | |
| 70 | + // 파일큐에 Push 한다. | |
| 71 | + queue = queuePool.get(queueIndex); | |
| 72 | + queue.pushMessageToBuffer(data); | |
| 73 | + // 큐인덱서를 증가시킨다. | |
| 74 | + queueIndex++; | |
| 75 | + } | |
| 76 | + } | |
| 77 | +} |
--- src/main/java/com/munjaon/server/queue/pool/SmsQueuePool.java
+++ src/main/java/com/munjaon/server/queue/pool/SmsQueuePool.java
... | ... | @@ -1,84 +1,15 @@ |
| 1 | 1 |
package com.munjaon.server.queue.pool; |
| 2 | 2 |
|
| 3 |
-import com.munjaon.server.queue.dto.BasicMessageDto; |
|
| 4 |
-import com.munjaon.server.queue.service.SmsWriteQueue; |
|
| 5 |
- |
|
| 6 |
-import java.util.LinkedList; |
|
| 7 |
- |
|
| 8 |
-public class SmsQueuePool {
|
|
| 9 |
- /** Lock Object */ |
|
| 10 |
- private final Object lockMonitor = new Object(); |
|
| 11 |
- /** File Queue Pool */ |
|
| 12 |
- private final LinkedList<SmsWriteQueue> queuePool = new LinkedList<>(); |
|
| 13 |
- /** File Queue */ |
|
| 14 |
- private SmsWriteQueue queue = null; |
|
| 15 |
- /** File Queue 분배를 위한 인덱서 */ |
|
| 16 |
- private int queueIndex = 0; |
|
| 17 |
- |
|
| 3 |
+public class SmsQueuePool extends QueuePool {
|
|
| 18 | 4 |
/** Singleton Instance */ |
| 19 |
- private static SmsQueuePool fileQueue; |
|
| 5 |
+ private static SmsQueuePool queueInstance = null; |
|
| 6 |
+ |
|
| 7 |
+ private SmsQueuePool() {}
|
|
| 20 | 8 |
|
| 21 | 9 |
public synchronized static SmsQueuePool getInstance(){
|
| 22 |
- if(fileQueue == null){
|
|
| 23 |
- fileQueue = new SmsQueuePool(); |
|
| 10 |
+ if(queueInstance == null){
|
|
| 11 |
+ queueInstance = new SmsQueuePool(); |
|
| 24 | 12 |
} |
| 25 |
- return fileQueue; |
|
| 26 |
- } |
|
| 27 |
- |
|
| 28 |
- /** Queue 존재하는지 조회 */ |
|
| 29 |
- public boolean isExistQueue(String name){
|
|
| 30 |
- synchronized(lockMonitor){
|
|
| 31 |
- boolean isExist = false; |
|
| 32 |
- for (SmsWriteQueue writeQueue : queuePool) {
|
|
| 33 |
- if (name.equals(writeQueue.getQueueName())) {
|
|
| 34 |
- isExist = true; |
|
| 35 |
- break; |
|
| 36 |
- } |
|
| 37 |
- } |
|
| 38 |
- return isExist; |
|
| 39 |
- } |
|
| 40 |
- } |
|
| 41 |
- /** Queue 제거 */ |
|
| 42 |
- public void removeQueue(String name){
|
|
| 43 |
- synchronized(lockMonitor) {
|
|
| 44 |
- for (int loopCnt = 0; loopCnt < queuePool.size(); loopCnt++) {
|
|
| 45 |
- queue = queuePool.get(loopCnt); |
|
| 46 |
- if(name.equals(queue.getQueueName())){
|
|
| 47 |
- queuePool.remove(loopCnt); |
|
| 48 |
- System.out.println("[SMS Queue] [" + queue.getQueueName() + " is Removed]");
|
|
| 49 |
- break; |
|
| 50 |
- } |
|
| 51 |
- } |
|
| 52 |
- } |
|
| 53 |
- } |
|
| 54 |
- /** Queue 등록 */ |
|
| 55 |
- public void addShortQueue(SmsWriteQueue queue){
|
|
| 56 |
- synchronized(lockMonitor){
|
|
| 57 |
- if (queue != null){
|
|
| 58 |
- queuePool.addLast(queue); |
|
| 59 |
- lockMonitor.notifyAll(); |
|
| 60 |
- } |
|
| 61 |
- } |
|
| 62 |
- } |
|
| 63 |
- /** Queue 데이터 저장 */ |
|
| 64 |
- public void pushQueue(BasicMessageDto data) throws Exception{
|
|
| 65 |
- synchronized(lockMonitor) {
|
|
| 66 |
- if (queuePool.isEmpty()) {
|
|
| 67 |
- try{
|
|
| 68 |
- lockMonitor.wait(); |
|
| 69 |
- }catch(InterruptedException e){
|
|
| 70 |
- // 아무 처리도 하지 않는다. |
|
| 71 |
- } |
|
| 72 |
- } |
|
| 73 |
- //큐리스트의 끝까지 이동한 경우 처음으로 되돌린다. |
|
| 74 |
- if (queueIndex >= queuePool.size()) {
|
|
| 75 |
- queueIndex = 0; |
|
| 76 |
- } |
|
| 77 |
- // 파일큐에 Push 한다. |
|
| 78 |
- queue = queuePool.get(queueIndex); |
|
| 79 |
- queue.pushMessageToBuffer(data); |
|
| 80 |
- // 큐인덱서를 증가시킨다. |
|
| 81 |
- queueIndex++; |
|
| 82 |
- } |
|
| 13 |
+ return queueInstance; |
|
| 83 | 14 |
} |
| 84 | 15 |
} |
--- src/main/java/com/munjaon/server/queue/service/SmsWriteQueue.java
+++ src/main/java/com/munjaon/server/queue/pool/SmsWriteQueue.java
... | ... | @@ -1,4 +1,4 @@ |
| 1 |
-package com.munjaon.server.queue.service; |
|
| 1 |
+package com.munjaon.server.queue.pool; |
|
| 2 | 2 |
|
| 3 | 3 |
import com.munjaon.server.config.ServiceCode; |
| 4 | 4 |
import com.munjaon.server.queue.config.QueueConstants; |
... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 |
} |
| 18 | 18 |
|
| 19 | 19 |
@Override |
| 20 |
- public int isisValidateMessageForExtend(BasicMessageDto messageDto) {
|
|
| 20 |
+ public int isValidateMessageForExtend(BasicMessageDto messageDto) {
|
|
| 21 | 21 |
/* 13. 메시지 */ |
| 22 | 22 |
if (MessageUtil.isEmptyForMessage(messageDto.getUserMessage(), true) || MessageUtil.isOverByteForMessage(messageDto.getUserMessage(), SmsBodyConfig.SMS_MSG_BYTE_LENGTH, false)) {
|
| 23 | 23 |
return ServiceCode.MSG_ERROR_SMS_MESSAGE.getCode(); |
--- src/main/java/com/munjaon/server/queue/service/WriteQueue.java
+++ src/main/java/com/munjaon/server/queue/pool/WriteQueue.java
... | ... | @@ -1,4 +1,4 @@ |
| 1 |
-package com.munjaon.server.queue.service; |
|
| 1 |
+package com.munjaon.server.queue.pool; |
|
| 2 | 2 |
|
| 3 | 3 |
import com.munjaon.server.config.ServiceCode; |
| 4 | 4 |
import com.munjaon.server.queue.config.BodyCommonConfig; |
... | ... | @@ -157,7 +157,7 @@ |
| 157 | 157 |
return result; |
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 |
- return isisValidateMessageForExtend(messageDto); |
|
| 160 |
+ return isValidateMessageForExtend(messageDto); |
|
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 | 163 |
protected int isValidateMessageForCommon(BasicMessageDto messageDto) {
|
... | ... | @@ -213,7 +213,7 @@ |
| 213 | 213 |
return ServiceCode.OK.getCode(); |
| 214 | 214 |
} |
| 215 | 215 |
|
| 216 |
- abstract int isisValidateMessageForExtend(BasicMessageDto messageDto); |
|
| 216 |
+ abstract int isValidateMessageForExtend(BasicMessageDto messageDto); |
|
| 217 | 217 |
abstract void pushMessageToBuffer(BasicMessageDto messageDto) throws Exception; |
| 218 | 218 |
abstract void initDataBuffer(); |
| 219 | 219 |
} |
+++ src/main/java/com/munjaon/server/queue/service/KakaoAlarmQueueService.java
... | ... | @@ -0,0 +1,37 @@ |
| 1 | +package com.munjaon.server.queue.service; | |
| 2 | + | |
| 3 | +import com.munjaon.server.queue.dto.BasicMessageDto; | |
| 4 | +import com.munjaon.server.queue.pool.WriteQueue; | |
| 5 | +import lombok.RequiredArgsConstructor; | |
| 6 | +import lombok.extern.slf4j.Slf4j; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +@Slf4j | |
| 10 | +@Service | |
| 11 | +@RequiredArgsConstructor | |
| 12 | +public class KakaoAlarmQueueService implements QueueAction { | |
| 13 | + @Override | |
| 14 | + public boolean isExistQueue(String name) { | |
| 15 | + return false; | |
| 16 | + } | |
| 17 | + | |
| 18 | + @Override | |
| 19 | + public void removeQueue(String name) { | |
| 20 | + | |
| 21 | + } | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void addQueue(WriteQueue queue) { | |
| 25 | + | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public void pushQueue(BasicMessageDto data) { | |
| 30 | + | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public int saveMessageToTable(BasicMessageDto data) { | |
| 35 | + return 0; | |
| 36 | + } | |
| 37 | +} |
+++ src/main/java/com/munjaon/server/queue/service/KakaoFriendQueueService.java
... | ... | @@ -0,0 +1,37 @@ |
| 1 | +package com.munjaon.server.queue.service; | |
| 2 | + | |
| 3 | +import com.munjaon.server.queue.dto.BasicMessageDto; | |
| 4 | +import com.munjaon.server.queue.pool.WriteQueue; | |
| 5 | +import lombok.RequiredArgsConstructor; | |
| 6 | +import lombok.extern.slf4j.Slf4j; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +@Slf4j | |
| 10 | +@Service | |
| 11 | +@RequiredArgsConstructor | |
| 12 | +public class KakaoFriendQueueService implements QueueAction { | |
| 13 | + @Override | |
| 14 | + public boolean isExistQueue(String name) { | |
| 15 | + return false; | |
| 16 | + } | |
| 17 | + | |
| 18 | + @Override | |
| 19 | + public void removeQueue(String name) { | |
| 20 | + | |
| 21 | + } | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void addQueue(WriteQueue queue) { | |
| 25 | + | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public void pushQueue(BasicMessageDto data) { | |
| 30 | + | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public int saveMessageToTable(BasicMessageDto data) { | |
| 35 | + return 0; | |
| 36 | + } | |
| 37 | +} |
--- src/main/java/com/munjaon/server/queue/service/KakaoQueueService.java
... | ... | @@ -1,11 +0,0 @@ |
| 1 | -package com.munjaon.server.queue.service; | |
| 2 | - | |
| 3 | -import lombok.RequiredArgsConstructor; | |
| 4 | -import lombok.extern.slf4j.Slf4j; | |
| 5 | -import org.springframework.stereotype.Service; | |
| 6 | - | |
| 7 | -@Slf4j | |
| 8 | -@Service | |
| 9 | -@RequiredArgsConstructor | |
| 10 | -public class KakaoQueueService { | |
| 11 | -} |
--- src/main/java/com/munjaon/server/queue/service/LmsQueueService.java
+++ src/main/java/com/munjaon/server/queue/service/LmsQueueService.java
... | ... | @@ -1,5 +1,8 @@ |
| 1 | 1 |
package com.munjaon.server.queue.service; |
| 2 | 2 |
|
| 3 |
+import com.munjaon.server.queue.dto.BasicMessageDto; |
|
| 4 |
+import com.munjaon.server.queue.pool.LmsQueuePool; |
|
| 5 |
+import com.munjaon.server.queue.pool.WriteQueue; |
|
| 3 | 6 |
import lombok.RequiredArgsConstructor; |
| 4 | 7 |
import lombok.extern.slf4j.Slf4j; |
| 5 | 8 |
import org.springframework.stereotype.Service; |
... | ... | @@ -7,5 +10,40 @@ |
| 7 | 10 |
@Slf4j |
| 8 | 11 |
@Service |
| 9 | 12 |
@RequiredArgsConstructor |
| 10 |
-public class LmsQueueService {
|
|
| 13 |
+public class LmsQueueService implements QueueAction {
|
|
| 14 |
+ private final LmsQueuePool queueInstance = LmsQueuePool.getInstance(); |
|
| 15 |
+ |
|
| 16 |
+ @Override |
|
| 17 |
+ public boolean isExistQueue(String name) {
|
|
| 18 |
+ return queueInstance.isExistQueue(name); |
|
| 19 |
+ } |
|
| 20 |
+ |
|
| 21 |
+ @Override |
|
| 22 |
+ public void removeQueue(String name) {
|
|
| 23 |
+ queueInstance.removeQueue(name); |
|
| 24 |
+ } |
|
| 25 |
+ |
|
| 26 |
+ @Override |
|
| 27 |
+ public void addQueue(WriteQueue queue) {
|
|
| 28 |
+ queueInstance.addQueue(queue); |
|
| 29 |
+ } |
|
| 30 |
+ |
|
| 31 |
+ @Override |
|
| 32 |
+ public void pushQueue(BasicMessageDto data) {
|
|
| 33 |
+ boolean isError = false; |
|
| 34 |
+ try {
|
|
| 35 |
+ queueInstance.pushQueue(data); |
|
| 36 |
+ } catch (Exception e) {
|
|
| 37 |
+ isError = true; |
|
| 38 |
+// throw new RuntimeException(e); |
|
| 39 |
+ } |
|
| 40 |
+ if (isError) {
|
|
| 41 |
+ log.error("Push queue failed");
|
|
| 42 |
+ } |
|
| 43 |
+ } |
|
| 44 |
+ |
|
| 45 |
+ @Override |
|
| 46 |
+ public int saveMessageToTable(BasicMessageDto data) {
|
|
| 47 |
+ return 0; |
|
| 48 |
+ } |
|
| 11 | 49 |
} |
--- src/main/java/com/munjaon/server/queue/service/MmsQueueService.java
+++ src/main/java/com/munjaon/server/queue/service/MmsQueueService.java
... | ... | @@ -1,5 +1,8 @@ |
| 1 | 1 |
package com.munjaon.server.queue.service; |
| 2 | 2 |
|
| 3 |
+import com.munjaon.server.queue.dto.BasicMessageDto; |
|
| 4 |
+import com.munjaon.server.queue.pool.MmsQueuePool; |
|
| 5 |
+import com.munjaon.server.queue.pool.WriteQueue; |
|
| 3 | 6 |
import lombok.RequiredArgsConstructor; |
| 4 | 7 |
import lombok.extern.slf4j.Slf4j; |
| 5 | 8 |
import org.springframework.stereotype.Service; |
... | ... | @@ -7,5 +10,39 @@ |
| 7 | 10 |
@Slf4j |
| 8 | 11 |
@Service |
| 9 | 12 |
@RequiredArgsConstructor |
| 10 |
-public class MmsQueueService {
|
|
| 13 |
+public class MmsQueueService implements QueueAction {
|
|
| 14 |
+ private final MmsQueuePool queueInstance = MmsQueuePool.getInstance(); |
|
| 15 |
+ @Override |
|
| 16 |
+ public boolean isExistQueue(String name) {
|
|
| 17 |
+ return queueInstance.isExistQueue(name); |
|
| 18 |
+ } |
|
| 19 |
+ |
|
| 20 |
+ @Override |
|
| 21 |
+ public void removeQueue(String name) {
|
|
| 22 |
+ queueInstance.removeQueue(name); |
|
| 23 |
+ } |
|
| 24 |
+ |
|
| 25 |
+ @Override |
|
| 26 |
+ public void addQueue(WriteQueue queue) {
|
|
| 27 |
+ queueInstance.addQueue(queue); |
|
| 28 |
+ } |
|
| 29 |
+ |
|
| 30 |
+ @Override |
|
| 31 |
+ public void pushQueue(BasicMessageDto data) {
|
|
| 32 |
+ boolean isError = false; |
|
| 33 |
+ try {
|
|
| 34 |
+ queueInstance.pushQueue(data); |
|
| 35 |
+ } catch (Exception e) {
|
|
| 36 |
+ isError = true; |
|
| 37 |
+// throw new RuntimeException(e); |
|
| 38 |
+ } |
|
| 39 |
+ if (isError) {
|
|
| 40 |
+ log.error("Push queue failed");
|
|
| 41 |
+ } |
|
| 42 |
+ } |
|
| 43 |
+ |
|
| 44 |
+ @Override |
|
| 45 |
+ public int saveMessageToTable(BasicMessageDto data) {
|
|
| 46 |
+ return 0; |
|
| 47 |
+ } |
|
| 11 | 48 |
} |
+++ src/main/java/com/munjaon/server/queue/service/QueueAction.java
... | ... | @@ -0,0 +1,12 @@ |
| 1 | +package com.munjaon.server.queue.service; | |
| 2 | + | |
| 3 | +import com.munjaon.server.queue.dto.BasicMessageDto; | |
| 4 | +import com.munjaon.server.queue.pool.WriteQueue; | |
| 5 | + | |
| 6 | +public interface QueueAction { | |
| 7 | + boolean isExistQueue(String name); | |
| 8 | + void removeQueue(String name); | |
| 9 | + void addQueue(WriteQueue queue); | |
| 10 | + void pushQueue(BasicMessageDto data); | |
| 11 | + int saveMessageToTable(BasicMessageDto data); | |
| 12 | +} |
--- src/main/java/com/munjaon/server/queue/service/QueueServiceInjector.java
+++ src/main/java/com/munjaon/server/queue/service/QueueServiceInjector.java
... | ... | @@ -16,20 +16,24 @@ |
| 16 | 16 |
@Autowired |
| 17 | 17 |
private MmsQueueService mmsQueueService; |
| 18 | 18 |
@Autowired |
| 19 |
- private KakaoQueueService kakaoQueueService; |
|
| 19 |
+ private KakaoAlarmQueueService kakaoAlarmQueueService; |
|
| 20 |
+ @Autowired |
|
| 21 |
+ private KakaoFriendQueueService kakaoFriendQueueService; |
|
| 20 | 22 |
|
| 21 | 23 |
@PostConstruct |
| 22 | 24 |
public void postConstruct() {
|
| 23 | 25 |
for (QueueService svc : EnumSet.allOf(QueueService.class)) {
|
| 24 | 26 |
switch (svc) {
|
| 25 |
- case SMS_QUEUE: svc.setService(smsQueueService); |
|
| 27 |
+ case SMS_QUEUE_SERVICE: svc.setService(smsQueueService); |
|
| 26 | 28 |
break; |
| 27 |
- case LMS_QUEUE: svc.setService(lmsQueueService); |
|
| 29 |
+ case LMS_QUEUE_SERVICE: svc.setService(lmsQueueService); |
|
| 28 | 30 |
break; |
| 29 |
- case MMS_QUEUE: svc.setService(mmsQueueService); |
|
| 31 |
+ case MMS_QUEUE_SERVICE: svc.setService(mmsQueueService); |
|
| 30 | 32 |
break; |
| 31 |
- case KAKAO_QUEUE: svc.setService(kakaoQueueService); |
|
| 33 |
+ case KAT_QUEUE_SERVICE: svc.setService(kakaoAlarmQueueService); |
|
| 32 | 34 |
break; |
| 35 |
+ case KFT_QUEUE_SERVICE: svc.setService(kakaoFriendQueueService); |
|
| 36 |
+ break; |
|
| 33 | 37 |
default: break; |
| 34 | 38 |
} |
| 35 | 39 |
} |
--- src/main/java/com/munjaon/server/queue/service/SmsQueueService.java
+++ src/main/java/com/munjaon/server/queue/service/SmsQueueService.java
... | ... | @@ -1,5 +1,8 @@ |
| 1 | 1 |
package com.munjaon.server.queue.service; |
| 2 | 2 |
|
| 3 |
+import com.munjaon.server.queue.dto.BasicMessageDto; |
|
| 4 |
+import com.munjaon.server.queue.pool.SmsQueuePool; |
|
| 5 |
+import com.munjaon.server.queue.pool.WriteQueue; |
|
| 3 | 6 |
import lombok.RequiredArgsConstructor; |
| 4 | 7 |
import lombok.extern.slf4j.Slf4j; |
| 5 | 8 |
import org.springframework.stereotype.Service; |
... | ... | @@ -7,5 +10,40 @@ |
| 7 | 10 |
@Slf4j |
| 8 | 11 |
@Service |
| 9 | 12 |
@RequiredArgsConstructor |
| 10 |
-public class SmsQueueService {
|
|
| 13 |
+public class SmsQueueService implements QueueAction {
|
|
| 14 |
+ private final SmsQueuePool queueInstance = SmsQueuePool.getInstance(); |
|
| 15 |
+ |
|
| 16 |
+ @Override |
|
| 17 |
+ public boolean isExistQueue(String name) {
|
|
| 18 |
+ return queueInstance.isExistQueue(name); |
|
| 19 |
+ } |
|
| 20 |
+ |
|
| 21 |
+ @Override |
|
| 22 |
+ public void removeQueue(String name) {
|
|
| 23 |
+ queueInstance.removeQueue(name); |
|
| 24 |
+ } |
|
| 25 |
+ |
|
| 26 |
+ @Override |
|
| 27 |
+ public void addQueue(WriteQueue queue) {
|
|
| 28 |
+ queueInstance.addQueue(queue); |
|
| 29 |
+ } |
|
| 30 |
+ |
|
| 31 |
+ @Override |
|
| 32 |
+ public void pushQueue(BasicMessageDto data) {
|
|
| 33 |
+ boolean isError = false; |
|
| 34 |
+ try {
|
|
| 35 |
+ queueInstance.pushQueue(data); |
|
| 36 |
+ } catch (Exception e) {
|
|
| 37 |
+ isError = true; |
|
| 38 |
+// throw new RuntimeException(e); |
|
| 39 |
+ } |
|
| 40 |
+ if (isError) {
|
|
| 41 |
+ log.error("Push queue failed");
|
|
| 42 |
+ } |
|
| 43 |
+ } |
|
| 44 |
+ |
|
| 45 |
+ @Override |
|
| 46 |
+ public int saveMessageToTable(BasicMessageDto data) {
|
|
| 47 |
+ return 0; |
|
| 48 |
+ } |
|
| 11 | 49 |
} |
--- src/main/java/com/munjaon/server/scheduler/service/CacheScheduleService.java
+++ src/main/java/com/munjaon/server/scheduler/service/CacheScheduleService.java
... | ... | @@ -17,6 +17,8 @@ |
| 17 | 17 |
private String tableSchema; |
| 18 | 18 |
/* 사용자 테이블 마지막 업데이트 시간 */ |
| 19 | 19 |
private String member_last_modified_time = null; |
| 20 |
+ /* 사용자 설정 테이블 마지막 업데이트 시간 */ |
|
| 21 |
+ private String config_last_modified_time = null; |
|
| 20 | 22 |
|
| 21 | 23 |
@Scheduled(cron="0/5 * * * * *") |
| 22 | 24 |
public void doService() throws Exception {
|
... | ... | @@ -24,18 +26,19 @@ |
| 24 | 26 |
} |
| 25 | 27 |
|
| 26 | 28 |
private void doMemberService() {
|
| 27 |
- if (member_last_modified_time == null) {
|
|
| 29 |
+ if (member_last_modified_time == null || config_last_modified_time == null) {
|
|
| 28 | 30 |
log.info("Member List Info is First Caching~~~");
|
| 29 | 31 |
memberService.deleteAllMember(); |
| 30 | 32 |
// memberService.list(); |
| 31 | 33 |
|
| 32 | 34 |
/* 회원 정보 마지막 변경시간 저장 */ |
| 33 |
- member_last_modified_time = memberService.getLastModifiedTime(tableSchema); |
|
| 35 |
+ member_last_modified_time = memberService.getMemberLastModifiedTime(tableSchema); |
|
| 36 |
+ config_last_modified_time = memberService.getConfigLastModifiedTime(tableSchema); |
|
| 34 | 37 |
return; |
| 35 | 38 |
} |
| 36 | 39 |
|
| 37 | 40 |
/* 변경이 없는 경우 */ |
| 38 |
- if (member_last_modified_time.equals(memberService.getLastModifiedTime(tableSchema))) {
|
|
| 41 |
+ if (member_last_modified_time.equals(memberService.getMemberLastModifiedTime(tableSchema)) && config_last_modified_time.equals(memberService.getConfigLastModifiedTime(tableSchema))) {
|
|
| 39 | 42 |
return; |
| 40 | 43 |
} |
| 41 | 44 |
|
... | ... | @@ -44,6 +47,7 @@ |
| 44 | 47 |
memberService.deleteAllMember(); |
| 45 | 48 |
// memberService.list(); |
| 46 | 49 |
/* 회원 정보 마지막 변경시간 저장 */ |
| 47 |
- member_last_modified_time = memberService.getLastModifiedTime(tableSchema); |
|
| 50 |
+ member_last_modified_time = memberService.getMemberLastModifiedTime(tableSchema); |
|
| 51 |
+ config_last_modified_time = memberService.getConfigLastModifiedTime(tableSchema); |
|
| 48 | 52 |
} |
| 49 | 53 |
} |
+++ src/main/java/com/munjaon/server/server/config/ServerConfig.java
... | ... | @@ -0,0 +1,13 @@ |
| 1 | +package com.munjaon.server.server.config; | |
| 2 | + | |
| 3 | +public final class ServerConfig { | |
| 4 | + /* 서버 타임아웃 체크 시간 */ | |
| 5 | + public static final int CYCLE_SOCKET_TIMEOUT = 3000; | |
| 6 | + /* 서버 연결후 로그인 만료 시간 */ | |
| 7 | + public static final int LIMIT_BIND_TIMEOUT = 5000; | |
| 8 | + /* Session Check 만료 시간 */ | |
| 9 | + public static final int LIMIT_LINK_CHECK_TIMEOUT = 35000; | |
| 10 | + | |
| 11 | + /* 서버 프로퍼티 reload interval 시간 */ | |
| 12 | + public static final Long INTERVAL_PROPERTY_RELOAD_TIME = 3000L; | |
| 13 | +} |
+++ src/main/java/com/munjaon/server/server/dto/ConnectUserDto.java
... | ... | @@ -0,0 +1,44 @@ |
| 1 | +package com.munjaon.server.server.dto; | |
| 2 | + | |
| 3 | +import com.munjaon.server.server.config.ServerConfig; | |
| 4 | +import lombok.Builder; | |
| 5 | +import lombok.Getter; | |
| 6 | +import lombok.Setter; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +@Getter | |
| 10 | +@Setter | |
| 11 | +@Builder | |
| 12 | +@ToString | |
| 13 | +public class ConnectUserDto { | |
| 14 | + /* 로그인여부 */ | |
| 15 | + private boolean isLogin; | |
| 16 | + /* 마지막 통신 시간 */ | |
| 17 | + private Long lastTrafficTime; | |
| 18 | + /* 서비스 유형 */ | |
| 19 | + private String serviceType; | |
| 20 | + /* 사용자 ID */ | |
| 21 | + private String userId; | |
| 22 | + /* 사용자 접속 IP */ | |
| 23 | + private String remoteIP; | |
| 24 | + /* 요금제(선불 : P / 후불 : A) */ | |
| 25 | + private final String feeType = "A"; | |
| 26 | + | |
| 27 | + public int isAlive() { | |
| 28 | + if (isLogin) { | |
| 29 | + if (System.currentTimeMillis() - lastTrafficTime > ServerConfig.LIMIT_LINK_CHECK_TIMEOUT) { | |
| 30 | + return 2; | |
| 31 | + } | |
| 32 | + } else { | |
| 33 | + if (System.currentTimeMillis() - lastTrafficTime > ServerConfig.LIMIT_BIND_TIMEOUT) { | |
| 34 | + return 1; | |
| 35 | + } | |
| 36 | + } | |
| 37 | + | |
| 38 | + return 0; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void updateLastTrafficTime() { | |
| 42 | + this.lastTrafficTime = System.currentTimeMillis(); | |
| 43 | + } | |
| 44 | +} |
+++ src/main/java/com/munjaon/server/server/sample/ExecutorServiceTest3.java
... | ... | @@ -0,0 +1,40 @@ |
| 1 | +package com.munjaon.server.server.sample; | |
| 2 | + | |
| 3 | +import java.util.ArrayList; | |
| 4 | +import java.util.List; | |
| 5 | +import java.util.concurrent.ExecutionException; | |
| 6 | +import java.util.concurrent.ExecutorService; | |
| 7 | +import java.util.concurrent.Executors; | |
| 8 | +import java.util.concurrent.Future; | |
| 9 | + | |
| 10 | +public class ExecutorServiceTest3 { | |
| 11 | + public static void main(String args[]) { | |
| 12 | + final int maxCore = Runtime.getRuntime().availableProcessors(); | |
| 13 | + System.out.println("maxCore : " + maxCore); | |
| 14 | + final ExecutorService executor = Executors.newFixedThreadPool(maxCore); | |
| 15 | + final List<Future<String>> futures = new ArrayList<>(); | |
| 16 | + | |
| 17 | + for (int i = 1; i < 5; i++) { | |
| 18 | + final int index = i; | |
| 19 | + futures.add(executor.submit(() -> { | |
| 20 | + System.out.println("finished job" + index); | |
| 21 | + return "job" + index + " " + Thread.currentThread().getName(); | |
| 22 | + })); | |
| 23 | + } | |
| 24 | + | |
| 25 | + for (Future<String> future : futures) { | |
| 26 | + String result = null; | |
| 27 | + try { | |
| 28 | + result = future.get(); | |
| 29 | + } catch (InterruptedException e) { | |
| 30 | + e.printStackTrace(); | |
| 31 | + } catch (ExecutionException e) { | |
| 32 | + e.printStackTrace(); | |
| 33 | + } | |
| 34 | + System.out.println(result); | |
| 35 | + } | |
| 36 | + | |
| 37 | + executor.shutdownNow(); | |
| 38 | + System.out.println("end"); | |
| 39 | + } | |
| 40 | +} |
+++ src/main/java/com/munjaon/server/server/sample/ExecutorServiceTest4.java
... | ... | @@ -0,0 +1,63 @@ |
| 1 | +package com.munjaon.server.server.sample; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.concurrent.ArrayBlockingQueue; | |
| 5 | +import java.util.concurrent.BlockingQueue; | |
| 6 | +import java.util.concurrent.ExecutorService; | |
| 7 | +import java.util.concurrent.Executors; | |
| 8 | + | |
| 9 | +public class ExecutorServiceTest4 { | |
| 10 | + public static void main(String args[]) { | |
| 11 | + ParallelExcutorService service = new ParallelExcutorService(); | |
| 12 | + service.submit("job1"); | |
| 13 | + service.submit("job2"); | |
| 14 | + service.submit("job3"); | |
| 15 | + service.submit("job4"); | |
| 16 | + | |
| 17 | + for (int i = 0 ; i < 4; i++) { | |
| 18 | + String result = service.take(); | |
| 19 | + System.out.println(result); | |
| 20 | + } | |
| 21 | + | |
| 22 | + System.out.println("end"); | |
| 23 | + service.close(); | |
| 24 | + } | |
| 25 | + | |
| 26 | + private static class ParallelExcutorService { | |
| 27 | + private final int maxCore = Runtime.getRuntime().availableProcessors(); | |
| 28 | + private final ExecutorService executor = Executors.newFixedThreadPool(maxCore); | |
| 29 | + private final BlockingQueue<String> queue = new ArrayBlockingQueue<>(10); | |
| 30 | + | |
| 31 | + public ParallelExcutorService() { | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void submit(String job) { | |
| 35 | + executor.submit(() -> { | |
| 36 | + String threadName = Thread.currentThread().getName(); | |
| 37 | + System.out.println("finished " + job); | |
| 38 | + String result = job + ", " + threadName; | |
| 39 | + try { | |
| 40 | + queue.put(result); | |
| 41 | + } catch (InterruptedException e) { | |
| 42 | + Thread.currentThread().interrupt(); | |
| 43 | + } | |
| 44 | + }); | |
| 45 | + } | |
| 46 | + | |
| 47 | + public String take() { | |
| 48 | + try { | |
| 49 | + return queue.take(); | |
| 50 | + } catch (InterruptedException e) { | |
| 51 | + Thread.currentThread().interrupt(); | |
| 52 | + throw new IllegalStateException(e); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void close() { | |
| 57 | + List<Runnable> unfinishedTasks = executor.shutdownNow(); | |
| 58 | + if (!unfinishedTasks.isEmpty()) { | |
| 59 | + System.out.println("Not all tasks finished before calling close: " + unfinishedTasks.size()); | |
| 60 | + } | |
| 61 | + } | |
| 62 | + } | |
| 63 | +} |
--- src/main/java/com/munjaon/server/server/service/BaseService.java
... | ... | @@ -1,208 +0,0 @@ |
| 1 | -package com.munjaon.server.server.service; | |
| 2 | - | |
| 3 | -import com.munjaon.server.util.LogUtil; | |
| 4 | - | |
| 5 | -import java.sql.SQLException; | |
| 6 | -import java.text.SimpleDateFormat; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import java.time.format.DateTimeFormatter; | |
| 9 | - | |
| 10 | -public abstract class BaseService extends Thread { | |
| 11 | - boolean bEndProcess = false; | |
| 12 | - | |
| 13 | - public static SimpleDateFormat sdf = new SimpleDateFormat("[MM-dd HH:mm:ss]"); | |
| 14 | - public static String LOG_DATE_FORMAT = "[MM-dd HH:mm:ss]"; | |
| 15 | - | |
| 16 | - public boolean ready; | |
| 17 | - private boolean KILL_FLAG; | |
| 18 | - private boolean STOP_FLAG; | |
| 19 | - private boolean RUN_FLAG; | |
| 20 | - private String LOG_FILE; | |
| 21 | - public LogUtil logger; | |
| 22 | - | |
| 23 | - public BaseService() {} | |
| 24 | - | |
| 25 | - public BaseService(String ServiceID) { | |
| 26 | - super(ServiceID); | |
| 27 | - | |
| 28 | - LOG_FILE = getProp("LOG_FILE"); | |
| 29 | - } | |
| 30 | - | |
| 31 | - protected void checkRun() { | |
| 32 | - RUN_FLAG = "1".equals(getProp("RUN_FLAG")) ? true : false; | |
| 33 | - } | |
| 34 | - | |
| 35 | - protected boolean isRun() { | |
| 36 | - return RUN_FLAG && !STOP_FLAG && !KILL_FLAG; | |
| 37 | - } | |
| 38 | - | |
| 39 | - protected void setLogFile(String sLogFile) { | |
| 40 | - if( logger != null ) { | |
| 41 | - logger.close(); | |
| 42 | - logger = null; | |
| 43 | - } | |
| 44 | - | |
| 45 | - logger = new LogUtil( sLogFile ); | |
| 46 | - } | |
| 47 | - | |
| 48 | - protected void Init() throws Exception { | |
| 49 | - LOG_FILE = getProp("LOG_FILE"); | |
| 50 | - | |
| 51 | - setLogFile( LOG_FILE ); | |
| 52 | - | |
| 53 | - SystemLog("Service Initializing..."); | |
| 54 | - | |
| 55 | - ready = true; | |
| 56 | - } | |
| 57 | - | |
| 58 | - public synchronized void Start() { | |
| 59 | - super.start(); | |
| 60 | - } | |
| 61 | - | |
| 62 | - protected synchronized void Stop() { | |
| 63 | - STOP_FLAG = true; | |
| 64 | - | |
| 65 | - SystemLog("Service Stoping..."); | |
| 66 | - } | |
| 67 | - | |
| 68 | - protected synchronized void Kill() { | |
| 69 | - if( !KILL_FLAG ) SystemLog("Service Killing..."); | |
| 70 | - | |
| 71 | - KILL_FLAG = true; | |
| 72 | - } | |
| 73 | - | |
| 74 | - protected void startService() throws Exception { | |
| 75 | - Log("startService() called."); | |
| 76 | - } | |
| 77 | - | |
| 78 | - protected void stopService() throws Exception { | |
| 79 | - Log("stopService() called."); | |
| 80 | - } | |
| 81 | - | |
| 82 | - protected synchronized void Reload() throws Exception { | |
| 83 | - } | |
| 84 | - | |
| 85 | - @Override | |
| 86 | - public void run() { | |
| 87 | - while (!KILL_FLAG) { | |
| 88 | - STOP_FLAG = false; | |
| 89 | - | |
| 90 | - if (isRun()) { | |
| 91 | - try { | |
| 92 | - Init(); | |
| 93 | - | |
| 94 | - SystemLog("Service Starting."); | |
| 95 | - | |
| 96 | - startService(); | |
| 97 | - } catch (SQLException e) { | |
| 98 | - STOP_FLAG = true; | |
| 99 | - SystemLog("SQLErrorCode = "+e.getErrorCode()); | |
| 100 | - SystemLog(e); | |
| 101 | - } catch (Exception e) { | |
| 102 | - STOP_FLAG = true; | |
| 103 | - SystemLog(e); | |
| 104 | - } finally { | |
| 105 | - ready = false; | |
| 106 | - SystemLog("Service Stoped."); | |
| 107 | - if( logger != null ) { logger.close(); logger = null; } | |
| 108 | - } | |
| 109 | - } | |
| 110 | - | |
| 111 | - if( !KILL_FLAG ) { | |
| 112 | - try { | |
| 113 | - Thread.sleep(5000); | |
| 114 | - } catch (Exception e) { | |
| 115 | - } | |
| 116 | - } | |
| 117 | - } | |
| 118 | - | |
| 119 | - try { | |
| 120 | - stopService(); | |
| 121 | - } catch (Exception e) { | |
| 122 | - | |
| 123 | - } | |
| 124 | - SystemLog("Service Killed."); | |
| 125 | - | |
| 126 | - ServiceRunner.SERVICES.remove(getName()); | |
| 127 | - bEndProcess = true; | |
| 128 | - } | |
| 129 | - | |
| 130 | - public void stopThread() { | |
| 131 | - SystemLog("kill signal has been received."); | |
| 132 | - SystemLog("remaining tasks are handled."); | |
| 133 | - | |
| 134 | - bEndProcess = true; | |
| 135 | - Kill(); | |
| 136 | - | |
| 137 | - int i=0; | |
| 138 | - while (true) { | |
| 139 | - try { | |
| 140 | - Thread.sleep(1*1000); | |
| 141 | - } catch(InterruptedException e) { | |
| 142 | - e.printStackTrace(); | |
| 143 | - } | |
| 144 | - | |
| 145 | - if(bEndProcess) { | |
| 146 | - break; | |
| 147 | - } | |
| 148 | - | |
| 149 | - SystemLog("remaining tasks - processing " + (++i) + " secs."); | |
| 150 | - } | |
| 151 | - | |
| 152 | - this.interrupt(); | |
| 153 | - try { | |
| 154 | - Thread.sleep(100); | |
| 155 | - } catch(InterruptedException e) { | |
| 156 | - e.printStackTrace(); | |
| 157 | - } | |
| 158 | - SystemLog("Service was interrupted."); | |
| 159 | - } | |
| 160 | - | |
| 161 | - protected void SystemLog(Object obj) { | |
| 162 | - Log(obj, true); | |
| 163 | - } | |
| 164 | - | |
| 165 | - protected void Log(Object obj) { | |
| 166 | - Log(obj, false); | |
| 167 | - } | |
| 168 | - | |
| 169 | - protected void Log(Object obj, boolean bOut) { | |
| 170 | - if( bOut ) { | |
| 171 | - System.out.println(LocalDateTime.now().format(DateTimeFormatter.ofPattern(LOG_DATE_FORMAT)) + " {{"+ getName() +"}} "+obj); | |
| 172 | - } | |
| 173 | - | |
| 174 | - if( logger != null ) { | |
| 175 | - logger.log(obj); | |
| 176 | - } | |
| 177 | - else { | |
| 178 | - if( obj instanceof Throwable ) { | |
| 179 | - LogUtil.log(LOG_FILE, obj); | |
| 180 | - } | |
| 181 | - else { | |
| 182 | - LogUtil.log(LOG_FILE, "{{"+ getName() +"}} "+obj); | |
| 183 | - } | |
| 184 | - } | |
| 185 | - } | |
| 186 | - | |
| 187 | - protected String getProp(String name) { | |
| 188 | - return getProp(getName(), name); | |
| 189 | - } | |
| 190 | - | |
| 191 | - public static String getProp(String svc, String name) { | |
| 192 | - return PropertyLoader.getProp(svc, name); | |
| 193 | - } | |
| 194 | -} | |
| 195 | - | |
| 196 | -class ShutdownService extends Thread { | |
| 197 | - private BaseService service = null; | |
| 198 | - | |
| 199 | - public ShutdownService(BaseService service) { | |
| 200 | - super(); | |
| 201 | - this.service = service; | |
| 202 | - } | |
| 203 | - | |
| 204 | - @Override | |
| 205 | - public void run() { | |
| 206 | - service.stopThread(); | |
| 207 | - } | |
| 208 | -} |
+++ src/main/java/com/munjaon/server/server/service/QueueServerService.java
... | ... | @@ -0,0 +1,42 @@ |
| 1 | +package com.munjaon.server.server.service; | |
| 2 | + | |
| 3 | +import org.json.simple.JSONObject; | |
| 4 | + | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +public class QueueServerService extends Service { | |
| 9 | + private int SMS_QUEUE_SIZE = 0; | |
| 10 | + private int LMS_QUEUE_SIZE = 0; | |
| 11 | + private int MMS_QUEUE_SIZE = 0; | |
| 12 | + private int KAT_QUEUE_SIZE = 0; | |
| 13 | + private int KFT_QUEUE_SIZE = 0; | |
| 14 | + | |
| 15 | + private Map<String, String> queueConfigMap = new HashMap<String, String>(); | |
| 16 | + | |
| 17 | + | |
| 18 | + @Override | |
| 19 | + public void checkReady() { | |
| 20 | + this.IS_READY_YN = true; | |
| 21 | + } | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void initResources() { | |
| 25 | + SMS_QUEUE_SIZE = | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public void releaseResources() { | |
| 30 | + | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public void doService() { | |
| 35 | + | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public JSONObject monitorService() { | |
| 40 | + return null; | |
| 41 | + } | |
| 42 | +} |
+++ src/main/java/com/munjaon/server/server/service/Server.java
... | ... | @@ -0,0 +1,117 @@ |
| 1 | +package com.munjaon.server.server.service; | |
| 2 | + | |
| 3 | +import com.munjaon.server.server.config.ServerConfig; | |
| 4 | +import com.munjaon.server.server.dto.ConnectUserDto; | |
| 5 | + | |
| 6 | +import java.io.IOException; | |
| 7 | +import java.net.InetSocketAddress; | |
| 8 | +import java.net.Socket; | |
| 9 | +import java.net.SocketAddress; | |
| 10 | +import java.nio.channels.SelectionKey; | |
| 11 | +import java.nio.channels.Selector; | |
| 12 | +import java.nio.channels.ServerSocketChannel; | |
| 13 | +import java.nio.channels.SocketChannel; | |
| 14 | +import java.util.Iterator; | |
| 15 | + | |
| 16 | +public abstract class Server { | |
| 17 | + private InetSocketAddress listenAddress; | |
| 18 | + private Selector selector; | |
| 19 | + /* 마지막 통신 시간 */ | |
| 20 | + private Long lastTrafficCheckTime = System.currentTimeMillis(); | |
| 21 | + | |
| 22 | + private Server(InetSocketAddress listenAddress) { | |
| 23 | + this.listenAddress = listenAddress; | |
| 24 | + } | |
| 25 | + | |
| 26 | + protected Server(String address, int port) throws IOException { | |
| 27 | + this(new InetSocketAddress(address, port)); | |
| 28 | + selector = Selector.open(); | |
| 29 | + /* 채널 생성 */ | |
| 30 | + ServerSocketChannel serverChannel = ServerSocketChannel.open(); | |
| 31 | + /* non-Blocking 설정 */ | |
| 32 | + serverChannel.configureBlocking(false); | |
| 33 | + /* 서버 ip, port 설정 */ | |
| 34 | + serverChannel.socket().bind(listenAddress); | |
| 35 | + /* 채널에 accept 대기 설정 */ | |
| 36 | + serverChannel.register(selector, SelectionKey.OP_ACCEPT); | |
| 37 | + } | |
| 38 | + | |
| 39 | + protected Iterator<SelectionKey> selectInterest() throws IOException { | |
| 40 | + if (selector.select(1000) == 0) { | |
| 41 | + return null; | |
| 42 | + } | |
| 43 | + | |
| 44 | + return selector.selectedKeys().iterator(); | |
| 45 | + } | |
| 46 | + | |
| 47 | + protected void execInterest(Iterator<SelectionKey> keys) throws IOException { | |
| 48 | + while (keys != null && keys.hasNext()) { | |
| 49 | + SelectionKey key = keys.next(); | |
| 50 | + /* 키 셋에서 제거. */ | |
| 51 | + keys.remove(); | |
| 52 | + if (!key.isValid()) { | |
| 53 | + continue; | |
| 54 | + } | |
| 55 | + | |
| 56 | + if (key.isAcceptable()) { // 접속일 경우.. | |
| 57 | + this.accept(selector, key); | |
| 58 | + } else if (key.isReadable()) { // 수신일 경우.. | |
| 59 | + this.receive(selector, key); | |
| 60 | + } else if (key.isWritable()) { // 발신일 경우.. | |
| 61 | + this.send(selector, key); | |
| 62 | + } | |
| 63 | + } | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected void accept(Selector selector, SelectionKey key) throws IOException { | |
| 67 | + /* 키 채널을 가져온다. */ | |
| 68 | + ServerSocketChannel serverChannel = (ServerSocketChannel) key.channel(); | |
| 69 | + /* accept을 해서 Socket 채널을 가져온다. */ | |
| 70 | + SocketChannel channel = serverChannel.accept(); | |
| 71 | + channel.configureBlocking(false); | |
| 72 | + /* 소켓 취득 */ | |
| 73 | + Socket socket = channel.socket(); | |
| 74 | + SocketAddress remoteAddr = socket.getRemoteSocketAddress(); | |
| 75 | + System.out.println("Connected to: " + remoteAddr); | |
| 76 | + // Socket 채널을 channel에 수신 등록한다 | |
| 77 | + channel.register(selector, SelectionKey.OP_READ, ConnectUserDto.builder().lastTrafficTime(System.currentTimeMillis()).remoteIP(remoteAddr.toString()).build()); | |
| 78 | + } | |
| 79 | + | |
| 80 | + protected void checkInterest() throws IOException { | |
| 81 | + if (lastTrafficCheckTime - System.currentTimeMillis() < ServerConfig.CYCLE_SOCKET_TIMEOUT) { | |
| 82 | + return; | |
| 83 | + } | |
| 84 | + Iterator<SelectionKey> keys = selector.keys().iterator(); | |
| 85 | + while (keys.hasNext()) { | |
| 86 | + SelectionKey key = keys.next(); | |
| 87 | + if (key.interestOps() == SelectionKey.OP_READ) { | |
| 88 | + ConnectUserDto userDto = (ConnectUserDto) key.attachment(); | |
| 89 | + | |
| 90 | + if (userDto != null) { | |
| 91 | + if (userDto.isAlive() != 0) { | |
| 92 | + System.out.println("userDto is disconnet"); | |
| 93 | + // 키 채널을 가져온다. | |
| 94 | + SocketChannel channel = (SocketChannel) key.channel(); | |
| 95 | + // 소켓 취득 | |
| 96 | + Socket socket = channel.socket(); | |
| 97 | + // 소켓 채널 닫기 | |
| 98 | + channel.close(); | |
| 99 | + // 소켓 닫기 | |
| 100 | + socket.close(); | |
| 101 | + // 키 닫기 | |
| 102 | + key.attach(null); | |
| 103 | + key.cancel(); | |
| 104 | + } | |
| 105 | + } | |
| 106 | + } | |
| 107 | + } | |
| 108 | + lastTrafficCheckTime = System.currentTimeMillis(); | |
| 109 | + } | |
| 110 | + | |
| 111 | + protected void releaseServer() throws IOException { | |
| 112 | + selector.close(); | |
| 113 | + } | |
| 114 | + | |
| 115 | + protected abstract void receive(Selector selector, SelectionKey key) throws IOException; | |
| 116 | + protected abstract void send(Selector selector, SelectionKey key) throws IOException; | |
| 117 | +} |
+++ src/main/java/com/munjaon/server/server/service/Service.java
... | ... | @@ -0,0 +1,139 @@ |
| 1 | +package com.munjaon.server.server.service; | |
| 2 | + | |
| 3 | +import com.munjaon.server.server.config.ServerConfig; | |
| 4 | +import com.munjaon.server.util.LogUtil; | |
| 5 | +import org.json.simple.JSONObject; | |
| 6 | + | |
| 7 | +import java.text.SimpleDateFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | +import java.time.format.DateTimeFormatter; | |
| 10 | + | |
| 11 | +public abstract class Service extends Thread { | |
| 12 | + public static final SimpleDateFormat sdf = new SimpleDateFormat("[MM-dd HH:mm:ss]"); | |
| 13 | + public static final String LOG_DATE_FORMAT = "[MM-dd HH:mm:ss]"; | |
| 14 | + | |
| 15 | + private String LOG_FILE; | |
| 16 | + protected LogUtil logger; | |
| 17 | + private Long LAST_PROPERTY_LOAD_TIME = 0L; | |
| 18 | + | |
| 19 | + protected boolean IS_SERVER_RUN; // 서버가 구동중인지 여부 | |
| 20 | + protected boolean IS_READY_YN; // 서비스 구동준비가 완료되었는지 체크 | |
| 21 | + protected boolean IS_RUN_YN; | |
| 22 | + protected boolean IS_STOP_YN; | |
| 23 | + | |
| 24 | + public Service() {} | |
| 25 | + public Service(String serviceName) { | |
| 26 | + super(serviceName); | |
| 27 | + LOG_FILE = getProp("LOG_FILE"); | |
| 28 | + } | |
| 29 | + | |
| 30 | + protected String getProp(String name) { | |
| 31 | + return getProp(getName(), name); | |
| 32 | + } | |
| 33 | + | |
| 34 | + public static String getProp(String svc, String name) { | |
| 35 | + return PropertyLoader.getProp(svc, name); | |
| 36 | + } | |
| 37 | + | |
| 38 | + protected void checkRun() { | |
| 39 | + this.IS_RUN_YN = getProp("RUN_FLAG") != null && "Y".equals(getProp("RUN_FLAG")); | |
| 40 | + } | |
| 41 | + | |
| 42 | + protected void checkServerRun() { | |
| 43 | + this.IS_SERVER_RUN = getProp("server", "run") != null && "Y".equals(getProp("server", "run")); | |
| 44 | + } | |
| 45 | + | |
| 46 | + public void reloadCheckRun() { | |
| 47 | + if ((System.currentTimeMillis() - this.LAST_PROPERTY_LOAD_TIME) > ServerConfig.INTERVAL_PROPERTY_RELOAD_TIME) { | |
| 48 | + checkRun(); | |
| 49 | + checkServerRun(); | |
| 50 | + this.LAST_PROPERTY_LOAD_TIME = System.currentTimeMillis(); | |
| 51 | + } | |
| 52 | + } | |
| 53 | + | |
| 54 | + public boolean isRun() { | |
| 55 | + return IS_SERVER_RUN && IS_RUN_YN && !IS_STOP_YN; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public boolean isReady() { | |
| 59 | + return IS_READY_YN; | |
| 60 | + } | |
| 61 | + | |
| 62 | + protected void setLogFile(String sLogFile) { | |
| 63 | + if ( logger != null ) { | |
| 64 | + logger.close(); | |
| 65 | + logger = null; | |
| 66 | + } | |
| 67 | + | |
| 68 | + logger = new LogUtil( sLogFile ); | |
| 69 | + } | |
| 70 | + | |
| 71 | + protected void saveSystemLog(Object obj) { | |
| 72 | + saveLog(obj, true); | |
| 73 | + } | |
| 74 | + | |
| 75 | + protected void saveLog(Object obj) { | |
| 76 | + saveLog(obj, false); | |
| 77 | + } | |
| 78 | + | |
| 79 | + protected void saveLog(Object obj, boolean isConsoleOutput) { | |
| 80 | + if(isConsoleOutput) { | |
| 81 | + System.out.println(LocalDateTime.now().format(DateTimeFormatter.ofPattern(LOG_DATE_FORMAT)) + " {{"+ getName() +"}} "+obj); | |
| 82 | + } | |
| 83 | + if (logger != null) { | |
| 84 | + logger.log(obj); | |
| 85 | + } else { | |
| 86 | + if (obj instanceof Throwable) { | |
| 87 | + LogUtil.log(LOG_FILE, obj); | |
| 88 | + } else { | |
| 89 | + LogUtil.log(LOG_FILE, "{{"+ getName() +"}} "+obj); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 94 | + protected void initLogFile() { | |
| 95 | + LOG_FILE = getProp("LOG_FILE"); | |
| 96 | + setLogFile( LOG_FILE ); | |
| 97 | + saveSystemLog("Service Log Initializing ... ..."); | |
| 98 | + } | |
| 99 | + | |
| 100 | + @Override | |
| 101 | + public void run() { | |
| 102 | + while (true) { | |
| 103 | + try { | |
| 104 | + /* 1. 서비스간의 dependency에 따른 체크 */ | |
| 105 | + checkReady(); | |
| 106 | + if (isRun() && isReady()) { | |
| 107 | + /* 2. 로그 초기화 */ | |
| 108 | + initLogFile(); | |
| 109 | + /* 3. 서비스 초기화 */ | |
| 110 | + initResources(); | |
| 111 | + /* 4. 서비스 시작 */ | |
| 112 | + doService(); | |
| 113 | + /* 5. 서비스 자원 해제 */ | |
| 114 | + releaseResources(); | |
| 115 | + saveSystemLog("Service Stopped."); | |
| 116 | + } else { | |
| 117 | + saveSystemLog("Service is Not Running."); | |
| 118 | + } | |
| 119 | + /* 6. 3초간 sleep */ | |
| 120 | + Thread.sleep(3000); | |
| 121 | + } catch (Exception e) { | |
| 122 | + saveSystemLog(e); | |
| 123 | + } finally { | |
| 124 | + if(logger != null) { logger.close(); logger = null; } | |
| 125 | + } | |
| 126 | + } | |
| 127 | + } | |
| 128 | + | |
| 129 | + /* 서비스간의 dependency에 따른 체크 */ | |
| 130 | + public abstract void checkReady(); | |
| 131 | + /* 추가적인 프로퍼티, 서비스 자원 초기화 */ | |
| 132 | + public abstract void initResources(); | |
| 133 | + /* 서비스 자원 해제 */ | |
| 134 | + public abstract void releaseResources(); | |
| 135 | + /* 서비스 */ | |
| 136 | + public abstract void doService(); | |
| 137 | + /* 모니터링을 위한 메소드 */ | |
| 138 | + public abstract JSONObject monitorService(); | |
| 139 | +} |
--- src/main/java/com/munjaon/server/server/service/ServiceRunner.java
... | ... | @@ -1,124 +0,0 @@ |
| 1 | -package com.munjaon.server.server.service; | |
| 2 | - | |
| 3 | -import java.io.File; | |
| 4 | -import java.net.URI; | |
| 5 | -import java.net.URL; | |
| 6 | -import java.net.URLClassLoader; | |
| 7 | -import java.util.Enumeration; | |
| 8 | -import java.util.Hashtable; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * | |
| 12 | - * @author JDS | |
| 13 | - */ | |
| 14 | -public class ServiceRunner extends Thread { | |
| 15 | - | |
| 16 | - public static String CLASS_DIR = PropertyLoader.get("SERVICE.CLASS_DIR"); | |
| 17 | - | |
| 18 | - public static Hashtable SERVICES = new Hashtable(); | |
| 19 | - | |
| 20 | - public void run() { | |
| 21 | - while(true) { | |
| 22 | - check(); | |
| 23 | - | |
| 24 | - try { | |
| 25 | - int iCheckCycle = Integer.parseInt(PropertyLoader.get("SERVICE.CHECK_CYCLE","3000")); | |
| 26 | - Thread.sleep( iCheckCycle ); | |
| 27 | - } catch (Exception e) { | |
| 28 | - } | |
| 29 | - } | |
| 30 | - } | |
| 31 | - | |
| 32 | - private void check() { | |
| 33 | - try { | |
| 34 | - String[] svcs = PropertyLoader.get("SERVICE.LISTS").split(","); | |
| 35 | - String svc_name; | |
| 36 | - | |
| 37 | - Hashtable map = new Hashtable(); | |
| 38 | - | |
| 39 | - for( int i=0; i<svcs.length; i++ ) { | |
| 40 | - svc_name = svcs[i].trim(); | |
| 41 | - | |
| 42 | - if( svc_name.length() == 0 || svc_name.startsWith("#") ) { | |
| 43 | - continue; | |
| 44 | - } | |
| 45 | - | |
| 46 | - map.put( svc_name, svc_name ); | |
| 47 | - } | |
| 48 | - | |
| 49 | - Enumeration enums = SERVICES.elements(); | |
| 50 | - | |
| 51 | - while( enums.hasMoreElements() ) { | |
| 52 | - BaseService svc = (BaseService) enums.nextElement(); | |
| 53 | - svc_name = svc.getName(); | |
| 54 | - | |
| 55 | - if( map.containsKey(svc_name) ) { | |
| 56 | - svc.checkRun(); | |
| 57 | - if( svc.isRun() && svc.ready ) { | |
| 58 | - svc.Reload(); | |
| 59 | - } | |
| 60 | - | |
| 61 | - map.remove(svc_name); | |
| 62 | - } | |
| 63 | - else { | |
| 64 | - svc.Kill(); | |
| 65 | - } | |
| 66 | - } | |
| 67 | - | |
| 68 | - enums = map.elements(); | |
| 69 | - | |
| 70 | - ShutdownService shutdownService = null; | |
| 71 | - while ( enums.hasMoreElements() ) { | |
| 72 | - svc_name = (String) enums.nextElement(); | |
| 73 | - | |
| 74 | - if( SERVICES.containsKey(svc_name) ) { | |
| 75 | - System.err.println("Already Started Service: "+ svc_name); | |
| 76 | - continue; | |
| 77 | - } | |
| 78 | - | |
| 79 | - String className = PropertyLoader.get(svc_name + ".CLASS"); | |
| 80 | - | |
| 81 | - Class cls = LoadClass( CLASS_DIR, className ); | |
| 82 | - | |
| 83 | - BaseService svc = (BaseService) cls.newInstance(); | |
| 84 | - svc.setName(svc_name); | |
| 85 | - svc.checkRun(); | |
| 86 | - if( svc.isRun() && svc.ready ) svc.Reload(); | |
| 87 | - | |
| 88 | - SERVICES.put(svc_name, svc); | |
| 89 | - | |
| 90 | - shutdownService = new ShutdownService(svc); | |
| 91 | - Runtime.getRuntime().addShutdownHook(shutdownService); | |
| 92 | - svc.Start(); | |
| 93 | - | |
| 94 | - Thread.sleep(500); | |
| 95 | - } | |
| 96 | - } catch(Exception e) { | |
| 97 | - e.printStackTrace(); | |
| 98 | - } | |
| 99 | - } | |
| 100 | - | |
| 101 | - public static Class LoadClass(String className) throws Exception { | |
| 102 | - Class cls = Class.forName(className.trim()); | |
| 103 | - | |
| 104 | - return cls; | |
| 105 | - } | |
| 106 | - | |
| 107 | - public static Class LoadClass(String path, String className) throws Exception { | |
| 108 | - /** | |
| 109 | - URL url = new File(path).toURL(); | |
| 110 | - URL[] urls = new URL[]{url}; | |
| 111 | - ClassLoader loader = new URLClassLoader(urls); | |
| 112 | - */ | |
| 113 | - URI uri = new File(path).toURI(); | |
| 114 | - URL[] urls = new URL[]{uri.toURL()}; | |
| 115 | - ClassLoader loader = new URLClassLoader(urls); | |
| 116 | - | |
| 117 | - return loader.loadClass(className); | |
| 118 | - } | |
| 119 | - | |
| 120 | - public static void main(String[] args) throws Exception { | |
| 121 | - new ServiceRunner().start(); | |
| 122 | - } | |
| 123 | - | |
| 124 | -} |
+++ src/main/java/com/munjaon/server/server/service/SocketServerService.java
... | ... | @@ -0,0 +1,30 @@ |
| 1 | +package com.munjaon.server.server.service; | |
| 2 | + | |
| 3 | +import org.json.simple.JSONObject; | |
| 4 | + | |
| 5 | +public class SocketServerService extends Service { | |
| 6 | + @Override | |
| 7 | + public void checkReady() { | |
| 8 | + | |
| 9 | + } | |
| 10 | + | |
| 11 | + @Override | |
| 12 | + public void initResources() { | |
| 13 | + | |
| 14 | + } | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public void releaseResources() { | |
| 18 | + | |
| 19 | + } | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public void doService() { | |
| 23 | + | |
| 24 | + } | |
| 25 | + | |
| 26 | + @Override | |
| 27 | + public JSONObject monitorService() { | |
| 28 | + return null; | |
| 29 | + } | |
| 30 | +} |
--- src/main/java/com/munjaon/server/util/XmlUtil.java
+++ src/main/java/com/munjaon/server/util/XmlUtil.java
... | ... | @@ -1,31 +1,124 @@ |
| 1 | 1 |
package com.munjaon.server.util; |
| 2 | 2 |
|
| 3 |
-import org.w3c.dom.Document; |
|
| 4 |
-import org.xml.sax.SAXException; |
|
| 3 |
+import org.jdom2.Document; |
|
| 4 |
+import org.jdom2.Element; |
|
| 5 |
+import org.jdom2.JDOMException; |
|
| 6 |
+import org.jdom2.input.SAXBuilder; |
|
| 7 |
+import org.jdom2.output.Format; |
|
| 8 |
+import org.jdom2.output.XMLOutputter; |
|
| 5 | 9 |
|
| 6 |
-import javax.xml.parsers.DocumentBuilder; |
|
| 7 |
-import javax.xml.parsers.DocumentBuilderFactory; |
|
| 8 |
-import javax.xml.parsers.ParserConfigurationException; |
|
| 9 | 10 |
import java.io.File; |
| 11 |
+import java.io.FileOutputStream; |
|
| 10 | 12 |
import java.io.IOException; |
| 13 |
+import java.io.StringReader; |
|
| 14 |
+import java.util.List; |
|
| 11 | 15 |
|
| 12 | 16 |
public class XmlUtil {
|
| 13 |
- private static Document getDOMParsedDocument(final String fileName) {
|
|
| 17 |
+// private static Document getDOMParsedDocument(final String fileName) {
|
|
| 18 |
+// Document document = null; |
|
| 19 |
+// try {
|
|
| 20 |
+// |
|
| 21 |
+// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
|
| 22 |
+// //If want to make namespace aware. |
|
| 23 |
+// //factory.setNamespaceAware(true); |
|
| 24 |
+// DocumentBuilder documentBuilder = factory.newDocumentBuilder(); |
|
| 25 |
+// document = documentBuilder.parse(new File("C:\\Docs\\JDS\\ITN\\MMS01Header.xml"));
|
|
| 26 |
+// |
|
| 27 |
+// NodeList nodeList = document.getDocumentElement().getChildNodes(); |
|
| 28 |
+// for (int i = 0; i < nodeList.getLength(); i++) {
|
|
| 29 |
+// Node node = nodeList.item(i); |
|
| 30 |
+// if (node.getNodeType() == Node.ELEMENT_NODE) {
|
|
| 31 |
+// Element elem = (Element) node; |
|
| 32 |
+// System.out.println("createDate : " + elem.getAttribute("createDate"));
|
|
| 33 |
+// System.out.println("getTagName : " + elem.getTagName());
|
|
| 34 |
+// System.out.println("getNodeName : " + elem.getNodeName());
|
|
| 35 |
+// System.out.println("getTextContent : " + elem.getTextContent());
|
|
| 36 |
+//// String createDate = elem.getElementsByTagName("createDate").item(0).getChildNodes().item(0).getNodeValue();
|
|
| 37 |
+//// System.out.println("createDate : " + createDate);
|
|
| 38 |
+//// String PopCounter = elem.getElementsByTagName("PopCounter").item(0).getChildNodes().item(0).getNodeValue();
|
|
| 39 |
+//// System.out.println("PopCounter : " + PopCounter);
|
|
| 40 |
+//// Double salary = Double.parseDouble(elem.getElementsByTagName("salary").item(0).getChildNodes().item(0).getNodeValue());
|
|
| 41 |
+// } |
|
| 42 |
+// } |
|
| 43 |
+// } |
|
| 44 |
+// catch (IOException | SAXException | ParserConfigurationException e) {
|
|
| 45 |
+// e.printStackTrace(); |
|
| 46 |
+// } |
|
| 47 |
+// return document; |
|
| 48 |
+// } |
|
| 49 |
+ |
|
| 50 |
+ private static Document getSaxParsedDocument(final String fileName) {
|
|
| 14 | 51 |
Document document = null; |
| 52 |
+ |
|
| 53 |
+ String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
|
| 54 |
+ + " <catalog>\r\n" |
|
| 55 |
+ + " <book id=\"bk101\">" |
|
| 56 |
+ + " <author>Gambardella, Matthew</author> " |
|
| 57 |
+ + "<title>XML Developer's Guide</title>" |
|
| 58 |
+ + " <genre>Computer</genre>" |
|
| 59 |
+ + " <price>44.95</price> " |
|
| 60 |
+ + "<publish_date>2000-10-01</publish_date> " |
|
| 61 |
+ + "<description>An in-depth look at creating applications with XML.</description> " |
|
| 62 |
+ + "</book>" |
|
| 63 |
+ + " <book id=\"bk102\">" |
|
| 64 |
+ + " <author>Ralls, Kim</author>" |
|
| 65 |
+ + " <title>Midnight Rain</title>" |
|
| 66 |
+ + " <genre>Fantasy</genre>" |
|
| 67 |
+ + " <price>5.95</price>" |
|
| 68 |
+ + " <publish_date>2000-12-16</publish_date>" |
|
| 69 |
+ + " <description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description>" |
|
| 70 |
+ + " </book> \r\n" |
|
| 71 |
+ + "</catalog>\r\n"; |
|
| 15 | 72 |
try {
|
| 16 | 73 |
|
| 17 |
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
|
| 18 |
- //If want to make namespace aware. |
|
| 19 |
- //factory.setNamespaceAware(true); |
|
| 20 |
- DocumentBuilder documentBuilder = factory.newDocumentBuilder(); |
|
| 21 |
- document = documentBuilder.parse(new File("employee.xml"));
|
|
| 22 |
- } |
|
| 23 |
- catch (IOException | SAXException | ParserConfigurationException e) {
|
|
| 74 |
+ SAXBuilder sax = new SAXBuilder(); |
|
| 75 |
+ // String that contains XML |
|
| 76 |
+ Document doc = (Document) sax.build(new File("C:\\Docs\\JDS\\ITN\\MMS01Header.xml"));
|
|
| 77 |
+// org.jdom2.Document doc = sax.build(new StringReader(xml)); |
|
| 78 |
+ |
|
| 79 |
+ Element rootNode = doc.getRootElement(); |
|
| 80 |
+ List<Element> bookElements = rootNode.getChildren(); |
|
| 81 |
+ System.out.println("bookElements: " + bookElements);
|
|
| 82 |
+ for(Element bookElement : bookElements){
|
|
| 83 |
+ String name = bookElement.getName(); |
|
| 84 |
+ String value = bookElement.getValue(); |
|
| 85 |
+ System.out.println(name + " : " + value); |
|
| 86 |
+ } |
|
| 87 |
+ } catch (IOException | JDOMException e) {
|
|
| 24 | 88 |
e.printStackTrace(); |
| 25 | 89 |
} |
| 26 | 90 |
return document; |
| 27 | 91 |
} |
| 28 |
- public static void main(String[] args) {
|
|
| 29 | 92 |
|
| 93 |
+ private static void writeSimpleXml() throws JDOMException, IOException {
|
|
| 94 |
+ |
|
| 95 |
+ String xml = "<root><child id=\"100\">mkyong</child></root>"; |
|
| 96 |
+ SAXBuilder sb = new SAXBuilder(); |
|
| 97 |
+ Document doc = sb.build(new StringReader(xml)); |
|
| 98 |
+ |
|
| 99 |
+ |
|
| 100 |
+ Document docFile = new Document(); |
|
| 101 |
+ |
|
| 102 |
+ Element rootElement = new Element("ReadQueue");
|
|
| 103 |
+ rootElement.addContent(new Element("createDate").setText("20240527"));
|
|
| 104 |
+ rootElement.addContent(new Element("PopCounter").setText(Integer.toString(0)));
|
|
| 105 |
+ |
|
| 106 |
+ docFile.setRootElement(rootElement); |
|
| 107 |
+ |
|
| 108 |
+ // default in compact mode |
|
| 109 |
+ // XMLOutputter xmlOutputter = new XMLOutputter(); |
|
| 110 |
+ |
|
| 111 |
+ // pretty print format |
|
| 112 |
+ XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat()); |
|
| 113 |
+ |
|
| 114 |
+ // output to console |
|
| 115 |
+ FileOutputStream fileOutputStream = new FileOutputStream("C:\\Docs\\JDS\\ITN\\file.xml");
|
|
| 116 |
+ xmlOutputter.output(docFile, fileOutputStream); |
|
| 117 |
+ |
|
| 118 |
+ } |
|
| 119 |
+ public static void main(String[] args) throws IOException, JDOMException {
|
|
| 120 |
+// XmlUtil.getDOMParsedDocument("C:\\Docs\\JDS\\ITN\\MMS01Header.xml");
|
|
| 121 |
+ XmlUtil.getSaxParsedDocument("C:\\Docs\\JDS\\ITN\\MMS01Header.xml");
|
|
| 122 |
+ XmlUtil.writeSimpleXml(); |
|
| 30 | 123 |
} |
| 31 | 124 |
} |
--- src/main/resources/dev/application-dev.yml
+++ src/main/resources/dev/application-dev.yml
... | ... | @@ -12,5 +12,6 @@ |
| 12 | 12 |
|
| 13 | 13 |
# ### 에이전트 설정 관련 #################################################################################### |
| 14 | 14 |
agent: |
| 15 |
+ root-path: C:/apps/agent_server |
|
| 15 | 16 |
server-property-file: C:/apps/agent_server/config/server.properties |
| 16 | 17 |
db-name: mjon_agent_back(No newline at end of file) |
--- src/main/resources/local/application-local.yml
+++ src/main/resources/local/application-local.yml
... | ... | @@ -12,5 +12,6 @@ |
| 12 | 12 |
|
| 13 | 13 |
# ### 에이전트 설정 관련 #################################################################################### |
| 14 | 14 |
agent: |
| 15 |
+ root-path: C:/apps/agent_server |
|
| 15 | 16 |
server-property-file: C:/apps/agent_server/config/server.properties |
| 16 | 17 |
db-name: mjon_agent_back(No newline at end of file) |
--- src/main/resources/prod/application-prod.yml
+++ src/main/resources/prod/application-prod.yml
... | ... | @@ -12,5 +12,6 @@ |
| 12 | 12 |
|
| 13 | 13 |
# ### 에이전트 설정 관련 #################################################################################### |
| 14 | 14 |
agent: |
| 15 |
+ root-path: C:/apps/agent_server |
|
| 15 | 16 |
server-property-file: C:/apps/agent_server/config/server.properties |
| 16 | 17 |
db-name: mjon_agent_back |
--- src/main/resources/sqlmap/member_sql.xml
+++ src/main/resources/sqlmap/member_sql.xml
... | ... | @@ -1,52 +1,100 @@ |
| 1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | 3 |
<mapper namespace="com.munjaon.server.cache.mapper.MemberMapper"> |
| 4 |
- <select id="getLastModifiedTime" resultType="String"> |
|
| 4 |
+ <select id="getMemberLastModifiedTime" resultType="String"> |
|
| 5 | 5 |
/* MemberMapper.getLastModifiedTime */ |
| 6 | 6 |
SELECT CASE WHEN UPDATE_TIME IS NULL THEN '0' ELSE DATE_FORMAT(UPDATE_TIME, '%Y%m%d%H%i%s') END AS last_modify_time |
| 7 | 7 |
FROM information_schema.tables |
| 8 | 8 |
WHERE TABLE_SCHEMA = #{tableSchema} AND TABLE_NAME = 'lettngnrlmber'
|
| 9 | 9 |
</select> |
| 10 |
+ <select id="getConfigLastModifiedTime" resultType="String"> |
|
| 11 |
+ /* MemberMapper.getLastModifiedTime */ |
|
| 12 |
+ SELECT CASE WHEN UPDATE_TIME IS NULL THEN '0' ELSE DATE_FORMAT(UPDATE_TIME, '%Y%m%d%H%i%s') END AS last_modify_time |
|
| 13 |
+ FROM information_schema.tables |
|
| 14 |
+ WHERE TABLE_SCHEMA = #{tableSchema} AND TABLE_NAME = 'mj_agent_mber_config'
|
|
| 15 |
+ </select> |
|
| 10 | 16 |
<select id="list" resultType="MemberDto"> |
| 11 | 17 |
/* MemberMapper.list */ |
| 12 | 18 |
SELECT |
| 13 |
- MBER_ID |
|
| 14 |
- , ESNTL_ID |
|
| 15 |
- , MBER_STTUS |
|
| 16 |
- , DEPT |
|
| 17 |
- , SHORT_PRICE |
|
| 18 |
- , LONG_PRICE |
|
| 19 |
- , PICTURE_PRICE |
|
| 20 |
- , PICTURE2_PRICE |
|
| 21 |
- , PICTURE3_PRICE |
|
| 22 |
- , KAKAO_AT_PRICE |
|
| 23 |
- , KAKAO_FT_PRICE |
|
| 24 |
- , KAKAO_FT_IMG_PRICE |
|
| 25 |
- , KAKAO_FT_WIDE_IMG_PRICE |
|
| 26 |
- , FAX_PRICE |
|
| 27 |
- , USER_MONEY |
|
| 28 |
- FROM lettngnrlmber |
|
| 19 |
+ MBER.* |
|
| 20 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.SMS_USE_YN IS NULL OR CONF.SMS_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS SMS_USE_YN |
|
| 21 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.LMS_USE_YN IS NULL OR CONF.LMS_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS LMS_USE_YN |
|
| 22 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.MMS_USE_YN IS NULL OR CONF.MMS_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS MMS_USE_YN |
|
| 23 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.KAKAO_AT_USE_YN IS NULL OR CONF.KAKAO_AT_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS KAKAO_AT_USE_YN |
|
| 24 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.KAKAO_FT_USE_YN IS NULL OR CONF.KAKAO_FT_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS KAKAO_FT_USE_YN |
|
| 25 |
+ , CASE WHEN CONF.SMS_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.SMS_LIMIT_COUNT END AS SMS_LIMIT_COUNT |
|
| 26 |
+ , CASE WHEN CONF.LMS_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.LMS_LIMIT_COUNT END AS LMS_LIMIT_COUNT |
|
| 27 |
+ , CASE WHEN CONF.MMS_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.MMS_LIMIT_COUNT END AS MMS_LIMIT_COUNT |
|
| 28 |
+ , CASE WHEN CONF.KAKAO_AT_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.KAKAO_AT_LIMIT_COUNT END AS KAKAO_AT_LIMIT_COUNT |
|
| 29 |
+ , CASE WHEN CONF.KAKAO_FT_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.KAKAO_FT_LIMIT_COUNT END AS KAKAO_FT_LIMIT_COUNT |
|
| 30 |
+ , CASE WHEN CONF.IP_LIMIT_YN IS NULL THEN 'Y' ELSE CONF.IP_LIMIT_YN END AS IP_LIMIT_YN |
|
| 31 |
+ , CASE WHEN CONF.ALLOW_IP_BASIC IS NULL THEN '0.0.0.0' ELSE CONF.ALLOW_IP_BASIC END AS ALLOW_IP_BASIC |
|
| 32 |
+ , CASE WHEN CONF.ALLOW_IP_EXTEND IS NULL THEN '0.0.0.0' ELSE CONF.ALLOW_IP_EXTEND END AS ALLOW_IP_EXTEND |
|
| 33 |
+ , CONF.SMS_AGENT_CODE |
|
| 34 |
+ , CONF.LMS_AGENT_CODE |
|
| 35 |
+ , CONF.MMS_AGENT_CODE |
|
| 36 |
+ , CONF.KAKAO_AT_AGENT_CODE |
|
| 37 |
+ , CONF.KAKAO_FT_AGENT_CODE |
|
| 38 |
+ FROM ( |
|
| 39 |
+ SELECT |
|
| 40 |
+ MBER_ID |
|
| 41 |
+ , ACCESS_KEY |
|
| 42 |
+ , MBER_STTUS |
|
| 43 |
+ , SHORT_PRICE |
|
| 44 |
+ , LONG_PRICE |
|
| 45 |
+ , PICTURE_PRICE |
|
| 46 |
+ , PICTURE2_PRICE |
|
| 47 |
+ , PICTURE3_PRICE |
|
| 48 |
+ , KAKAO_AT_PRICE |
|
| 49 |
+ , KAKAO_FT_PRICE |
|
| 50 |
+ , KAKAO_FT_IMG_PRICE |
|
| 51 |
+ , KAKAO_FT_WIDE_IMG_PRICE |
|
| 52 |
+ FROM lettngnrlmber |
|
| 53 |
+ ) MBER |
|
| 54 |
+ LEFT JOIN mj_agent_mber_config CONF |
|
| 55 |
+ ON MBER.MBER_ID = CONF.MBER_ID |
|
| 29 | 56 |
</select> |
| 30 | 57 |
<select id="get" resultType="MemberDto"> |
| 31 | 58 |
/* MemberMapper.get */ |
| 32 | 59 |
SELECT |
| 33 |
- MBER_ID |
|
| 34 |
- , ESNTL_ID |
|
| 35 |
- , MBER_STTUS |
|
| 36 |
- , DEPT |
|
| 37 |
- , SHORT_PRICE |
|
| 38 |
- , LONG_PRICE |
|
| 39 |
- , PICTURE_PRICE |
|
| 40 |
- , PICTURE2_PRICE |
|
| 41 |
- , PICTURE3_PRICE |
|
| 42 |
- , KAKAO_AT_PRICE |
|
| 43 |
- , KAKAO_FT_PRICE |
|
| 44 |
- , KAKAO_FT_IMG_PRICE |
|
| 45 |
- , KAKAO_FT_WIDE_IMG_PRICE |
|
| 46 |
- , FAX_PRICE |
|
| 47 |
- , USER_MONEY |
|
| 48 |
- FROM lettngnrlmber |
|
| 49 |
- WHERE MBER_ID = #{mberId}
|
|
| 60 |
+ MBER.* |
|
| 61 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.SMS_USE_YN IS NULL OR CONF.SMS_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS SMS_USE_YN |
|
| 62 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.LMS_USE_YN IS NULL OR CONF.LMS_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS LMS_USE_YN |
|
| 63 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.MMS_USE_YN IS NULL OR CONF.MMS_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS MMS_USE_YN |
|
| 64 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.KAKAO_AT_USE_YN IS NULL OR CONF.KAKAO_AT_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS KAKAO_AT_USE_YN |
|
| 65 |
+ , CASE WHEN MBER.MBER_STTUS = 'Y' THEN (CASE WHEN CONF.KAKAO_FT_USE_YN IS NULL OR CONF.KAKAO_FT_USE_YN = 'N' THEN 'N' ELSE 'Y' END) ELSE 'N' END AS KAKAO_FT_USE_YN |
|
| 66 |
+ , CASE WHEN CONF.SMS_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.SMS_LIMIT_COUNT END AS SMS_LIMIT_COUNT |
|
| 67 |
+ , CASE WHEN CONF.LMS_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.LMS_LIMIT_COUNT END AS LMS_LIMIT_COUNT |
|
| 68 |
+ , CASE WHEN CONF.MMS_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.MMS_LIMIT_COUNT END AS MMS_LIMIT_COUNT |
|
| 69 |
+ , CASE WHEN CONF.KAKAO_AT_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.KAKAO_AT_LIMIT_COUNT END AS KAKAO_AT_LIMIT_COUNT |
|
| 70 |
+ , CASE WHEN CONF.KAKAO_FT_LIMIT_COUNT IS NULL THEN 0 ELSE CONF.KAKAO_FT_LIMIT_COUNT END AS KAKAO_FT_LIMIT_COUNT |
|
| 71 |
+ , CASE WHEN CONF.IP_LIMIT_YN IS NULL THEN 'Y' ELSE CONF.IP_LIMIT_YN END AS IP_LIMIT_YN |
|
| 72 |
+ , CASE WHEN CONF.ALLOW_IP_BASIC IS NULL THEN '0.0.0.0' ELSE CONF.ALLOW_IP_BASIC END AS ALLOW_IP_BASIC |
|
| 73 |
+ , CASE WHEN CONF.ALLOW_IP_EXTEND IS NULL THEN '0.0.0.0' ELSE CONF.ALLOW_IP_EXTEND END AS ALLOW_IP_EXTEND |
|
| 74 |
+ , CONF.SMS_AGENT_CODE |
|
| 75 |
+ , CONF.LMS_AGENT_CODE |
|
| 76 |
+ , CONF.MMS_AGENT_CODE |
|
| 77 |
+ , CONF.KAKAO_AT_AGENT_CODE |
|
| 78 |
+ , CONF.KAKAO_FT_AGENT_CODE |
|
| 79 |
+ FROM ( |
|
| 80 |
+ SELECT |
|
| 81 |
+ MBER_ID |
|
| 82 |
+ , ACCESS_KEY |
|
| 83 |
+ , MBER_STTUS |
|
| 84 |
+ , SHORT_PRICE |
|
| 85 |
+ , LONG_PRICE |
|
| 86 |
+ , PICTURE_PRICE |
|
| 87 |
+ , PICTURE2_PRICE |
|
| 88 |
+ , PICTURE3_PRICE |
|
| 89 |
+ , KAKAO_AT_PRICE |
|
| 90 |
+ , KAKAO_FT_PRICE |
|
| 91 |
+ , KAKAO_FT_IMG_PRICE |
|
| 92 |
+ , KAKAO_FT_WIDE_IMG_PRICE |
|
| 93 |
+ FROM lettngnrlmber |
|
| 94 |
+ WHERE MBER_ID = #{mberId}
|
|
| 95 |
+ ) MBER |
|
| 96 |
+ LEFT JOIN (SELECT * FROM mj_agent_mber_config WHERE MBER_ID = #{mberId}) CONF
|
|
| 97 |
+ ON MBER.MBER_ID = CONF.MBER_ID |
|
| 50 | 98 |
</select> |
| 51 | 99 |
<update id="updateStts" parameterType="MemberDto"> |
| 52 | 100 |
UPDATE lettngnrlmber SET MBER_STTUS = #{mberSttus} WHERE MBER_ID = #{mberId}
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?