Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. package th.co.tac.svcbiz.ejb;
  2.  
  3. import java.util.Properties;
  4.  
  5. import javax.ejb.ActivationConfigProperty;
  6. import javax.ejb.MessageDriven;
  7.  
  8. import th.co.tac.coupon.constant.Constant;
  9. import th.co.tac.coupon.vo.CampaignVO;
  10. import th.co.tac.service.exception.ServiceException;
  11. import th.co.tac.service.salt.exception.SaltServiceException;
  12. import th.co.tac.svcbiz.cache.CustomerProfileCache;
  13. import th.co.tac.svcbiz.engine.ChckCriteriaEngine;
  14. import th.co.tac.svcbiz.engine.model.CustomerProfileModel;
  15. import th.co.tac.svcbiz.engine.model.ServiceBizEngineRequest;
  16. import th.co.tac.svcbiz.engine.model.ServiceBizEngineResponse;
  17. import th.co.tac.svcbiz.util.JMSUtil;
  18. import th.co.tac.util.DebugLoggable;
  19. import th.co.tac.ws.ussd.log.vo.USSDLogVO;
  20.  
  21. /**
  22. * <p>Cluster</p>
  23. * @version 1.1
  24. * @author Phongsathorn Anguyarn <phongsathorn@xp-link.com>
  25. * @since September, 2014
  26. *
  27. */
  28. @MessageDriven(
  29. activationConfig = {
  30. @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue.ServiceBizChckCriteriaQueueIn"),
  31. @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
  32. }, name="ServiceBizChckCriteriaMDB", mappedName = "queue.ServiceBizChckCriteriaQueueIn")
  33. //@TransactionAttribute(TransactionAttributeType.REQUIRED)
  34. public class ServiceBizChckCriteriaMDBBean extends AbstractServiceBizMDB {
  35.  
  36. private static final long serialVersionUID = -7750833650332783839L;
  37.  
  38. @Override
  39. public ServiceBizEngineResponse process(Properties msg, USSDLogVO logVo) throws ServiceException, SaltServiceException, Exception {
  40. long start = System.currentTimeMillis();
  41. log_info(">> Start ServiceBizCheckCriteria process.");
  42. try {
  43. ServiceBizEngineRequest request = (ServiceBizEngineRequest) msg.get("engineRequest");
  44. start = request.getRequestDttm().getTimeInMillis();
  45. ServiceBizEngineResponse response = ChckCriteriaEngine.checkCriteriaCondition(this.logger, request, Constant.SRVC_MODE_ASYNC);
  46. if( response.isSuccess() && response.getRespMesg() != null) {
  47. // for check dummy package code
  48. return response;
  49. }
  50.  
  51. // put condition into Cache;
  52. CustomerProfileCache customerProfileCache = new CustomerProfileCache(new DebugLoggable(this.logger, this.serviceName));
  53. CustomerProfileModel profile = customerProfileCache.get(request.getSessionId());
  54. CampaignVO cmpg = profile.getCampaignVO();
  55. int priority = cmpg.getQueuePriority();
  56.  
  57. // put message into JMS Queue
  58. String qName = getConfig("jms.queue.save-async");
  59. String qFac = getConfig("jms.queue.factory");
  60. JMSUtil.sendMessageToMDB("SendJmsSavePkg", qFac, qName, msg, logVo, priority, this.logger);
  61. log_info("## Successfully ServiceBizCheckCriteria");
  62. response = new ServiceBizEngineResponse();
  63. response.setPackAlias(cmpg.getCmpgName());
  64. response.setPackCode("");
  65. response.setWriteTxLog(false);
  66. response.setSendSms(false);
  67. response.setSuccess(true);
  68. return response;
  69. } finally {
  70. long end = System.currentTimeMillis() - start;
  71. log_info("<< End ServiceBizCheckCriteria process. elapsed time {0} ms.", end);
  72. }
  73. }
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement