Package org.mule.test.integration.spring.events

Source Code of org.mule.test.integration.spring.events.TestMuleEventBean

/*
* $Id: TestMuleEventBean.java 19191 2010-08-25 21:05:23Z tcarlson $
* --------------------------------------------------------------------------------------
* Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
*
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/

package org.mule.test.integration.spring.events;

import org.mule.module.spring.events.MuleApplicationEvent;
import org.mule.module.spring.events.MuleEventListener;
import org.mule.tck.functional.EventCallback;
import org.mule.util.StringMessageUtils;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationEvent;

/**
* <code>TestMuleEventBean</code> is a MuleEventBean for testing with the
* MuleEventMulticaster.
*/

public class TestMuleEventBean implements MuleEventListener
{
    private static final Log logger = LogFactory.getLog(TestMuleEventBean.class);

    private EventCallback eventCallback;

    public void onApplicationEvent(ApplicationEvent event)
    {
        MuleApplicationEvent e = (MuleApplicationEvent)event;

        logger.debug(StringMessageUtils.getBoilerPlate("Received message on " + e.getEndpoint()));

        if (eventCallback != null)
        {
            try
            {
                eventCallback.eventReceived(e.getMuleEventContext(), event);
            }
            catch (Exception e1)
            {
                throw new RuntimeException("Callback failed: " + e1.getMessage(), e1);
            }
        }
    }

    public EventCallback getEventCallback()
    {
        return eventCallback;
    }

    public void setEventCallback(EventCallback eventCallback)
    {
        this.eventCallback = eventCallback;
    }

}
TOP

Related Classes of org.mule.test.integration.spring.events.TestMuleEventBean

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.