Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  Service Activity Monitoring :: Server
  %%
  Copyright (C) 2011 Talend Inc.
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  #L%
  -->

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:osgix="http://www.springframework.org/schema/osgi-compendium" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
        http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd" >

    <import resource="classpath:META-INF/cxf/cxf.xml" />

    <context:annotation-config/>

    <!-- Configuration Admin entry -->
    <osgix:cm-properties id="sam-agent-props" persistent-id="org.talend.esb.sam.agent">
        <prop key="collector.scheduler.interval">500</prop>
        <prop key="collector.maxEventsPerCall">10</prop>
        <prop key="log.messageContent">true</prop>
        <prop key="log.maxContentLength">-1</prop>
        <prop key="service.url">http://localhost:8040/services/MonitoringServiceSOAP</prop>
        <prop key="service.retry.number">3</prop>
        <prop key="service.retry.delay">5000</prop>
    </osgix:cm-properties>

    <!-- placeholder configurer -->
    <!-- context:property-placeholder properties-ref="sam-agent-props" /-->
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="properties" ref="sam-agent-props" />
        <property name="placeholderPrefix" value="$sam{" />
    </bean>

    <bean id="eventFeature" class="org.talend.esb.sam.agent.feature.EventFeature">
        <property name="mapper" ref="eventMapper" />
        <property name="eventSender" ref="queueSender" />
        <property name="logMessageContent" value="$sam{log.messageContent}" />
    </bean>

    <bean id="eventMapper" class="org.talend.esb.sam.agent.eventproducer.MessageToEventMapperImpl">
        <property name="maxContentLength" value="$sam{log.maxContentLength}"/>
    </bean>

    <bean id="queueSender" class="org.talend.esb.sam.agent.collector.QueueSender">
        <property name="queue" ref="queue"/>
    </bean>

    <bean id="eventCollector" class="org.talend.esb.sam.agent.collector.EventCollectorImpl" >
        <!-- Default interval for scheduler. Start every X milliseconds a new scheduler -->
        <property name="defaultInterval" value="$sam{collector.scheduler.interval}" />
        <!-- Number of events within one service call. This is a maximum number. 
            If there are events in the queue, the events will be processed. -->
        <property name="eventsPerMessageCall" value="$sam{collector.maxEventsPerCall}" />
        <property name="monitoringServiceClient" ref="monitoringServceV1Wrapper" />
        <property name="executor" ref="defaultExecutor" />
        <property name="scheduler" ref="defaultScheduler" />
        <property name="bus" ref="cxf" />
        <property name="queue" ref="queue" />
    </bean>

    <bean id="queue" class="java.util.concurrent.ConcurrentLinkedQueue"/>

    <task:annotation-driven executor="defaultExecutor"
        scheduler="defaultScheduler" />
    <!-- Scheduler starts in the interval of defaultInterval property. Within 
        the execution of the scheduler new tasks will be created. This tasks will 
        be managed by executor. Change this parameters only for performance tuning. -->
    <task:scheduler id="defaultScheduler" pool-size="2" />
    <task:executor id="defaultExecutor" pool-size="10" />

    <jaxws:client id="monitoringServiceV1Client"
        serviceClass="org.talend.esb.sam.monitoringservice.v1.MonitoringService"
        address="$sam{service.url}">
        <jaxws:properties>
            <entry key="mtom-enabled" value="true"/>
        </jaxws:properties>
    </jaxws:client>

    <bean id="monitoringServceV1Wrapper" class="org.talend.esb.sam.agent.serviceclient.MonitoringServiceWrapper">
        <property name="monitoringService" ref="monitoringServiceV1Client" />
        <!-- Number of retries Default: 5 -->
        <property name="numberOfRetries" value="$sam{service.retry.number}" />
        <!-- Delay in milliseconds between the next attemp to send. Thread is blocked 
            for this time. Default: 1000 -->
        <property name="delayBetweenRetry" value="$sam{service.retry.delay}" />
    </bean>

</beans>
New to GrepCode? Check out our FAQ X