org.yestech.event.multicaster
Class CamelEventMulticaster<EVENT extends ICamelEvent,RESULT>

java.lang.Object
  extended by org.yestech.event.multicaster.BaseEventMulticaster<EVENT,RESULT>
      extended by org.yestech.event.multicaster.CamelEventMulticaster<EVENT,RESULT>
Type Parameters:
EVENT - An implementation of ICamelEvent, The event type the multicaster will handle.
RESULT - A serializable result that result type can handle.
All Implemented Interfaces:
IEventMulticaster<EVENT,RESULT>

@Component(value="camelEventMulticaster")
public class CamelEventMulticaster<EVENT extends ICamelEvent,RESULT>
extends BaseEventMulticaster<EVENT,RESULT>

A camel based event multicaster implementation.
An example with Spring Config:

 <beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <camel:camelContext id="context">
       <camel:jmxAgent id="contextAgent" disabled="true"/>
      <!-- will be default endpoint added to event fired -->
        <camel:endpoint uri="direct:processEvent" />
        <camel:route>
            <camel:from uri="direct:processEvent"/>
            <camel:to uri="bean:someBean?method=processEvent"/>
        </camel:route>
    </camel:camelContext>

     <bean id="eventMulticastor" class="org.yestech.event.CamelEventMulticaster" p:defaultContext-ref="context"/>

 </beans>
 

If the caller would like to get the Raw camel Exchange as the result the event must contain the EventResultType with a class of Exchange. It binds to a spring bean with id "camelEventMulticaster"


Constructor Summary
CamelEventMulticaster()
           
 
Method Summary
 Map<String,org.apache.camel.CamelContext> getContexts()
           
 org.apache.camel.CamelContext getDefaultContext()
           
 RESULT process(EVENT event)
          Called by the client to process an event.
 void setContexts(Map<String,org.apache.camel.CamelContext> contexts)
           
 void setDefaultContext(org.apache.camel.CamelContext defaultContext)
           
 
Methods inherited from class org.yestech.event.multicaster.BaseEventMulticaster
deregisterListener, destroy, getCorePoolSize, getKeepAliveTime, getMaximumPoolSize, getPool, init, initializeThreadPool, isCheckResultType, processAsync, registerListener, setCheckResultType, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setPool, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CamelEventMulticaster

public CamelEventMulticaster()
Method Detail

getContexts

public Map<String,org.apache.camel.CamelContext> getContexts()

setContexts

public void setContexts(Map<String,org.apache.camel.CamelContext> contexts)

getDefaultContext

public org.apache.camel.CamelContext getDefaultContext()

setDefaultContext

public void setDefaultContext(org.apache.camel.CamelContext defaultContext)

process

public RESULT process(EVENT event)
Description copied from interface: IEventMulticaster
Called by the client to process an event.

Parameters:
event - The event that should be processed.
Returns:
A result from the multicaster.


Copyright © 2010 YES Technology Association. All Rights Reserved.