Package com.cin.mdb

Source Code of com.cin.mdb.MeanWeekWageMDB

package com.cin.mdb;

import java.util.logging.Level;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;

import com.cin.dto.WageDTO;
import com.cin.log.EventLogger;
import com.cin.service.StaticDataService;

/**
* Message-Driven Bean implementation class for: MeanWeekWageMDB
*  Used to trigger the update of the mean week wage value
* in the wage details.
*/
@MessageDriven(
    activationConfig = { @ActivationConfigProperty(
        propertyName = "destinationType", propertyValue = "javax.jms.Queue"
    ) },
    mappedName = "jms/meanWeekWage")
public class MeanWeekWageMDB implements MessageListener {

    /**
     * Default constructor.
     */
    public MeanWeekWageMDB() {
        // TODO Auto-generated constructor stub
    }
 
  /**
     * @see MessageListener#onMessage(Message)
     */
    public void onMessage(Message message) {
      StaticDataService aService = new StaticDataService();
     
        try {
          ObjectMessage objectMessage = (ObjectMessage) message;
          Object object = objectMessage.getObject();
          if( object == null ){
           
                aService.updateMeanWeekWage();
          } else {
            WageDTO aWage = (WageDTO) object;
            aService.updateMeanWeekWage( aWage );
          }
    }
        catch (JMSException pException) {
      EventLogger.getInstance().log(Level.SEVERE, pException.getMessage());
    }
    }

}
TOP

Related Classes of com.cin.mdb.MeanWeekWageMDB

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.