Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
147 lines (131 sloc) 5.91 KB
<?xml version="1.0" encoding="UTF-8"?>
<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"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="string2MonitoringEvent"
class="com.octo.monitoring_flux.cep.processor.MarshallProcessor" />
<bean id="monitoringEvent2Map"
class="com.octo.monitoring_flux.cep.processor.FlattenMapProcessor" />
<!-- ****************** -->
<!-- * Camel Context * -->
<!-- ****************** -->
<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false">
<route id="frontend" trace="false">
<from uri="jeromq://tcp://127.0.0.1:${zeromq.frontend.port}?socketType=PULL&amp;linger=0&amp;label=frontend" />
<bean ref="string2MonitoringEvent" />
<multicast stopOnException="true">
<pipeline>
<bean ref="monitoringEvent2Map" />
<to uri="jest://${elasticsearch.url}?indexName=${elasticsearch.index.name}&amp;indexType=cep_to_elasticsearch" />
</pipeline>
<pipeline>
<to uri="esper://monitoring" />
</pipeline>
</multicast>
</route>
<route id="middleend" trace="false">
<from uri="jeromq://tcp://127.0.0.1:${zeromq.middleend.port}?socketType=PULL&amp;linger=0&amp;label=middleend" />
<bean ref="string2MonitoringEvent" />
<multicast stopOnException="true">
<pipeline>
<bean ref="monitoringEvent2Map" />
<to uri="jest://${elasticsearch.url}?indexName=${elasticsearch.index.name}&amp;indexType=cep_to_elasticsearch" />
</pipeline>
<pipeline>
<to uri="esper://monitoring" />
</pipeline>
</multicast>
</route>
<route id="backend" trace="false">
<from uri="jeromq://tcp://127.0.0.1:${zeromq.backend.port}?socketType=PULL&amp;linger=0&amp;label=backend" />
<bean ref="string2MonitoringEvent" />
<multicast stopOnException="true">
<pipeline>
<bean ref="monitoringEvent2Map" />
<to uri="jest://${elasticsearch.url}?indexName=${elasticsearch.index.name}&amp;indexType=cep_to_elasticsearch" />
</pipeline>
<pipeline>
<to uri="esper://monitoring" />
</pipeline>
</multicast>
</route>
<!-- ***************** CEP RECORDING ******************** -->
<!-- Throttling Record -->
<route id="cep.msg.tick" trace="false">
<from uri="esper://monitoring?eql=
insert into TicksPerSecond
select correlationId, count(*) as cnt
from com.octo.monitoring_flux.cep.MonitoringEvent.win:time_batch(1 sec)
group by correlationId" />
<to uri="stream:out" />
<to uri="esper://monitoring" />
</route>
<route id="cep.msg.avg" trace="false">
<from uri="esper://monitoring?eql=
insert into Moyenne10s
select correlationId, avg(cnt) as avgCnt, cnt as MsgCnt
from TicksPerSecond.win:time(10 sec)
group by correlationId" />
<to uri="esper://monitoring" />
</route>
<!-- Global SLA Record -->
<route id="cep.sla.global-sla-1" trace="false">
<from uri="esper://monitoring?eql=
insert into tmpGlobalSLA
select correlationId, MIN(timeStamp) as mini, MAX(timeStamp) as maxi
from com.octo.monitoring_flux.cep.MonitoringEvent.win:time_batch(5 sec)
group by correlationId" />
<to uri="esper://monitoring" />
</route>
<route id="cep.sla.global-sla-2" trace="false">
<from uri="esper://monitoring?eql=
insert into GlobalSLA
select correlationId, mini, maxi, 0 as elasped
from tmpGlobalSLA.win:time_batch(4 sec)" />
<to uri="bean://com.octo.monitoring_flux.cep.processor.ComputeGlobalSlaProcessor" />
<to uri="esper://monitoring" />
</route>
<!-- Unit SLA Record -->
<route id="cep.sla.unit-sla-1" trace="false">
<from uri="esper://monitoring?eql=
insert into UnitSla
select moduleType, elapsedTime
from com.octo.monitoring_flux.cep.MonitoringEvent.win:time_batch(5 sec)
where elapsedTime is not null" />
<to uri="esper://monitoring" />
</route>
<!-- ***************** CEP ACTIONS ******************** -->
<!-- Single Component breaks SLA -->
<route id="cep.sla.violation.unit" trace="false">
<from uri="esper://monitoring?eql=
select moduleType, elapsedTime
from UnitSla.win:time_batch(5 sec)
where elapsedTime > 0.3" />
<to uri="bean://com.octo.monitoring_flux.cep.processor.Esper2ElasticsearchProcessor" />
<to uri="jest://${elasticsearch.url}?indexName=${elasticsearch.index.name}&amp;indexType=unit_sla_violation" />
</route>
<!-- Business Chain breaks SLA -->
<route id="cep.sla.violation.global" trace="false">
<from uri="esper://monitoring?eql=
select correlationId, elasped
from GlobalSLA.win:time_batch(5 sec)
where elasped > 5" />
<to uri="bean://com.octo.monitoring_flux.cep.processor.Esper2ElasticsearchProcessor" />
<to uri="jest://${elasticsearch.url}?indexName=${elasticsearch.index.name}&amp;indexType=global_sla_violation" />
</route>
<!-- Throttling Violation -->
<route id="cep.sla.violation.throttling" trace="false">
<from uri="esper://monitoring?eql=
select correlationId, avgCnt
from Moyenne10s.win:time_batch(10 sec)
where avgCnt > 3" />
<to uri="bean://com.octo.monitoring_flux.cep.processor.Esper2ElasticsearchProcessor" />
<to uri="jest://${elasticsearch.url}?indexName=${elasticsearch.index.name}&amp;indexType=throttling_violation" />
</route>
</camelContext>
</beans>