Coverage Report - org.kuali.rice.ksb.messaging.quartz.MessageServiceExecutorJob
 
Classes in this File Line Coverage Branch Coverage Complexity
MessageServiceExecutorJob
0%
0/11
N/A
3
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  * 
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in
 5  
  * compliance with the License. You may obtain a copy of the License at
 6  
  * 
 7  
  * http://www.opensource.org/licenses/ecl2.php
 8  
  * 
 9  
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS
 10  
  * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
 11  
  * language governing permissions and limitations under the License.
 12  
  */
 13  
 package org.kuali.rice.ksb.messaging.quartz;
 14  
 
 15  
 import org.apache.log4j.Logger;
 16  
 import org.kuali.rice.ksb.messaging.MessageServiceInvoker;
 17  
 import org.kuali.rice.ksb.messaging.PersistedMessageBO;
 18  
 import org.kuali.rice.ksb.messaging.threadpool.KSBThreadPool;
 19  
 import org.kuali.rice.ksb.service.KSBServiceLocator;
 20  
 import org.kuali.rice.ksb.util.KSBConstants;
 21  
 import org.quartz.Job;
 22  
 import org.quartz.JobExecutionContext;
 23  
 import org.quartz.JobExecutionException;
 24  
 
 25  
 import java.io.Serializable;
 26  
 
 27  
 
 28  
 /**
 29  
  * Job saves a {@link org.kuali.rice.ksb.messaging.PersistedMessageBO} to the message queue in the state of 'R' and then puts into a
 30  
  * {@link MessageServiceInvoker} for execution in {@link KSBThreadPool}.
 31  
  * 
 32  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 33  
  * 
 34  
  */
 35  0
 public class MessageServiceExecutorJob implements Job, Serializable {
 36  
 
 37  0
     private static final Logger LOG = Logger.getLogger(MessageServiceExecutorJob.class);
 38  
 
 39  
     private static final long serialVersionUID = 6702139047380618522L;
 40  
 
 41  
     public static final String MESSAGE_KEY = "message";
 42  
 
 43  
     public void execute(JobExecutionContext jec) throws JobExecutionException {
 44  
         try {
 45  0
             PersistedMessageBO message = (PersistedMessageBO) jec.getJobDetail().getJobDataMap().get(MESSAGE_KEY);
 46  0
             message.setQueueStatus(KSBConstants.ROUTE_QUEUE_ROUTING);
 47  0
             KSBServiceLocator.getMessageQueueService().save(message);
 48  0
             KSBServiceLocator.getThreadPool().execute(new MessageServiceInvoker(message));
 49  0
         } catch (Throwable t) {
 50  0
             LOG.error("Caught throwable attempting to process message in exception messaging queue.", t);
 51  0
             throw new JobExecutionException(new Exception(t));
 52  0
         }
 53  0
     }
 54  
 }