|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.mule.extras.spring.events.MuleEventMulticaster
MuleEventMulticaster is an implementation of a Spring
ApplicationeventMulticaster. This implementation allows Mule event to be sent and
received through the Spring ApplicationContext. This allows any Spring bean to
receive and send events from any transport that Mule supports such as Jms, Http,
Tcp, Pop3, Smtp, File, etc. All a bean needs to do to receive and send events is
to implement MuleEventListener. Beans can also have subscriptions to certain
events by implementing MuleSubscriptionEventListener, where the bean can provide a
list of endpoints on which to receive events i.e.
<bean id="myListener" class="com.foo.MyListener">
<property name="subscriptions">
<list>
<value>jms://customer.support</value>
<value>pop3://support:123456@mail.mycompany.com</value>
</list>
</property>
</bean>
<bean id="applicationEventMulticaster" class="org.mule.extras.spring.events.MuleEventMulticaster">
<property name="subscriptions">
<list>
<value>jms://orders.queue</value>
<value>jms://another.orders.queue</value>
</list>
</property>
</bean>
<bean id="myListener" class="com.foo.MyListener">
<property name="subscriptions">
<list>
<value>jms://*.orders.*.</value>
</list>
</property>
</bean>
MuleEventListener,
MuleSubscriptionEventListener,
ApplicationEventMulticaster| Field Summary | |
protected org.springframework.context.ApplicationContext |
applicationContext
The Spring acpplication context |
protected boolean |
asynchronous
Determines whether events will be processed asynchronously |
protected edu.emory.mathcs.backport.java.util.concurrent.ExecutorService |
asyncPool
An ExecutorService for handling asynchronous events |
protected org.mule.umo.UMOComponent |
component
The mule instance compoennt for the Multicaster |
protected org.mule.umo.UMODescriptor |
descriptor
The Mule descriptor that belongs to this component instnace in Mule |
protected Map |
endpointMappings
Any logical endpointUri mappings to register with mule. |
static String |
EVENT_MULTICASTER_DESCRIPTOR_NAME
|
protected ExceptionListener |
exceptionListener
Used to store parsed endpoints |
protected Set |
listeners
The set of listeners for this Multicaster |
protected static Log |
logger
logger used by this class |
protected Class |
subscriptionFilter
The filter used to match subscriptions |
protected String[] |
subscriptions
A list of endpoints the eventMulticaster will receive events on Note that if this eventMulticaster has a Mule Descriptor associated with it, these endpoints are ignored and the ones on the Mule Descriptor are used. |
| Constructor Summary | |
MuleEventMulticaster()
|
|
| Method Summary | |
void |
addApplicationListener(org.springframework.context.ApplicationListener listener)
Adds a listener to the the Multicaster. |
protected org.mule.routing.filters.ObjectFilter |
createFilter(String pattern)
|
void |
destroy()
|
protected void |
dispatchEvent(MuleApplicationEvent applicationEvent)
Will dispatch an application event through Mule |
protected org.mule.umo.UMODescriptor |
getDefaultDescriptor()
|
Map |
getEndpointMappings()
Any logical endpointUri mappings to register with mule. |
Class |
getSubscriptionFilter()
the type of filter used to filter subscriptions |
String[] |
getSubscriptions()
A list of endpoints the eventMulticaster will receive events on Note that if this eventMulticaster has a Mule Descriptor associated with it, these endpoints are ignored and the ones on the Mule Descriptor are used. |
protected void |
initMule()
|
boolean |
isAsynchronous()
Determines whether events will be processed asynchronously |
void |
multicastEvent(org.springframework.context.ApplicationEvent e)
Method is used to dispatch events to listeners registered with the EventManager or dispatches events to Mule depending on the type and state of the event received. |
void |
onMuleEvent(org.mule.umo.UMOEventContext context)
This is the callback method used by Mule to give Mule events to this Multicaster |
protected void |
registerConnectors()
|
protected void |
registerEndpointMappings()
|
protected void |
registerGlobalEndpoints()
|
protected void |
registerMulticasterDescriptor()
|
protected void |
registerTransformers()
|
void |
removeAllListeners()
Removes all the listeners from the multicaster |
void |
removeApplicationListener(org.springframework.context.ApplicationListener listener)
Removes a listener from the multicaster |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Set the current Spring application context |
void |
setAsynchronous(boolean asynchronous)
Determines whether events will be processed asynchronously |
void |
setEndpointMappings(Map endpointMappings)
Any logical endpointUri mappings to register with mule. |
protected void |
setExceptionListener(ExceptionListener listener)
|
void |
setSubscriptionFilter(Class subscriptionFilter)
sets the type of filter used to filter subscriptions |
void |
setSubscriptions(String[] subscriptions)
A list of endpoints the eventMulticaster will receive events on Note that if this eventMulticaster has a Mule Descriptor associated with it, these endpoints are ignored and the ones on the Mule Descriptor are used. |
protected void |
setSubscriptionsOnDescriptor(org.mule.impl.MuleDescriptor descriptor)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String EVENT_MULTICASTER_DESCRIPTOR_NAME
protected static final Log logger
protected final Set listeners
protected boolean asynchronous
protected edu.emory.mathcs.backport.java.util.concurrent.ExecutorService asyncPool
protected Map endpointMappings
protected String[] subscriptions
protected org.springframework.context.ApplicationContext applicationContext
protected org.mule.umo.UMODescriptor descriptor
protected org.mule.umo.UMOComponent component
protected Class subscriptionFilter
protected ExceptionListener exceptionListener
| Constructor Detail |
public MuleEventMulticaster()
| Method Detail |
public void addApplicationListener(org.springframework.context.ApplicationListener listener)
AsynchronousMessageListener is used to wrap the listener. This
listener will be initialised with a threadpool. The configuration for the
threadpool can be set on this multicaster or inherited from the MuleManager
configuration, which is good for most cases.
addApplicationListener in interface org.springframework.context.event.ApplicationEventMulticasterlistener - the ApplicationListener to register with this MulticasterAsynchronousEventListener,
ThreadingProfilepublic void removeApplicationListener(org.springframework.context.ApplicationListener listener)
removeApplicationListener in interface org.springframework.context.event.ApplicationEventMulticasterlistener - the listener to removepublic void removeAllListeners()
removeAllListeners in interface org.springframework.context.event.ApplicationEventMulticasterpublic void multicastEvent(org.springframework.context.ApplicationEvent e)
multicastEvent in interface org.springframework.context.event.ApplicationEventMulticastere - application event received by the contextpublic boolean isAsynchronous()
public void setAsynchronous(boolean asynchronous)
asynchronous - true if aysnchronous
public void onMuleEvent(org.mule.umo.UMOEventContext context)
throws org.mule.umo.transformer.TransformerException,
org.mule.umo.endpoint.MalformedEndpointException
context - the context received by Mule
org.mule.umo.transformer.TransformerException
org.mule.umo.endpoint.MalformedEndpointException
protected void dispatchEvent(MuleApplicationEvent applicationEvent)
throws ApplicationEventException
applicationEvent - the Spring event to be dispatched
ApplicationEventException - if the event cannot be dispatched i.e. if
the underlying transport throws an exception
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareapplicationContext -
org.springframework.beans.BeansExceptionprotected void initMule()
protected void registerMulticasterDescriptor()
throws org.mule.umo.UMOException
org.mule.umo.UMOException
protected void setSubscriptionsOnDescriptor(org.mule.impl.MuleDescriptor descriptor)
throws org.mule.umo.UMOException
org.mule.umo.UMOException
protected void registerEndpointMappings()
throws org.mule.umo.lifecycle.InitialisationException
org.mule.umo.lifecycle.InitialisationException
protected void registerConnectors()
throws org.mule.umo.UMOException
org.mule.umo.UMOException
protected void registerGlobalEndpoints()
throws org.mule.umo.UMOException
org.mule.umo.UMOException
protected void registerTransformers()
throws org.mule.umo.UMOException
org.mule.umo.UMOException
protected org.mule.umo.UMODescriptor getDefaultDescriptor()
throws org.mule.umo.UMOException
org.mule.umo.UMOExceptionprotected org.mule.routing.filters.ObjectFilter createFilter(String pattern)
public Class getSubscriptionFilter()
WildcardFilterpublic void setSubscriptionFilter(Class subscriptionFilter)
subscriptionFilter - the class of the filter to use.public Map getEndpointMappings()
public void setEndpointMappings(Map endpointMappings)
endpointMappings - a map of logical names and endpoiut url stringspublic String[] getSubscriptions()
public void setSubscriptions(String[] subscriptions)
subscriptions - a list of enpoints to listen onprotected void setExceptionListener(ExceptionListener listener)
public void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||