Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package th.co.tac.svcbiz.ejb;
- import java.util.Properties;
- import javax.ejb.ActivationConfigProperty;
- import javax.ejb.MessageDriven;
- import th.co.tac.coupon.constant.Constant;
- import th.co.tac.coupon.vo.CampaignVO;
- import th.co.tac.service.exception.ServiceException;
- import th.co.tac.service.salt.exception.SaltServiceException;
- import th.co.tac.svcbiz.cache.CustomerProfileCache;
- import th.co.tac.svcbiz.engine.ChckCriteriaEngine;
- import th.co.tac.svcbiz.engine.model.CustomerProfileModel;
- import th.co.tac.svcbiz.engine.model.ServiceBizEngineRequest;
- import th.co.tac.svcbiz.engine.model.ServiceBizEngineResponse;
- import th.co.tac.svcbiz.util.JMSUtil;
- import th.co.tac.util.DebugLoggable;
- import th.co.tac.ws.ussd.log.vo.USSDLogVO;
- /**
- * <p>Cluster</p>
- * @version 1.1
- * @author Phongsathorn Anguyarn <phongsathorn@xp-link.com>
- * @since September, 2014
- *
- */
- @MessageDriven(
- activationConfig = {
- @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue.ServiceBizChckCriteriaQueueIn"),
- @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
- }, name="ServiceBizChckCriteriaMDB", mappedName = "queue.ServiceBizChckCriteriaQueueIn")
- //@TransactionAttribute(TransactionAttributeType.REQUIRED)
- public class ServiceBizChckCriteriaMDBBean extends AbstractServiceBizMDB {
- private static final long serialVersionUID = -7750833650332783839L;
- @Override
- public ServiceBizEngineResponse process(Properties msg, USSDLogVO logVo) throws ServiceException, SaltServiceException, Exception {
- long start = System.currentTimeMillis();
- log_info(">> Start ServiceBizCheckCriteria process.");
- try {
- ServiceBizEngineRequest request = (ServiceBizEngineRequest) msg.get("engineRequest");
- start = request.getRequestDttm().getTimeInMillis();
- ServiceBizEngineResponse response = ChckCriteriaEngine.checkCriteriaCondition(this.logger, request, Constant.SRVC_MODE_ASYNC);
- if( response.isSuccess() && response.getRespMesg() != null) {
- // for check dummy package code
- return response;
- }
- // put condition into Cache;
- CustomerProfileCache customerProfileCache = new CustomerProfileCache(new DebugLoggable(this.logger, this.serviceName));
- CustomerProfileModel profile = customerProfileCache.get(request.getSessionId());
- CampaignVO cmpg = profile.getCampaignVO();
- int priority = cmpg.getQueuePriority();
- // put message into JMS Queue
- String qName = getConfig("jms.queue.save-async");
- String qFac = getConfig("jms.queue.factory");
- JMSUtil.sendMessageToMDB("SendJmsSavePkg", qFac, qName, msg, logVo, priority, this.logger);
- log_info("## Successfully ServiceBizCheckCriteria");
- response = new ServiceBizEngineResponse();
- response.setPackAlias(cmpg.getCmpgName());
- response.setPackCode("");
- response.setWriteTxLog(false);
- response.setSendSms(false);
- response.setSuccess(true);
- return response;
- } finally {
- long end = System.currentTimeMillis() - start;
- log_info("<< End ServiceBizCheckCriteria process. elapsed time {0} ms.", end);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement