INTSAMPLES-95 Add Remote Monitor
INTSAMPLES-95 Add OperationInvokingAdapter For reference see: https://jira.springsource.org/browse/INTSAMPLES-95
This commit is contained in:
committed by
Gunnar Hillert
parent
1a2ecaf254
commit
ee8de8c6b0
@@ -0,0 +1,63 @@
|
||||
<?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:int-jmx="http://www.springframework.org/schema/integration/jmx"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jmx http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<bean id="clientConnector" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean">
|
||||
<property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:6969/jmxrmi"/>
|
||||
<property name="environment">
|
||||
<map>
|
||||
<entry key="jmx.remote.credentials" value="#{new String[] {'admin', 'cbycfvjkjjudosrxchsgijfnbsrpnqctnujeirubbacljkhh'}}" />
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<int-jmx:notification-listening-channel-adapter
|
||||
server="clientConnector"
|
||||
channel="publishInChannel"
|
||||
object-name="spring.application:type=TweetPublisher,name=*"/>
|
||||
|
||||
<int:channel id="publishInChannel"/>
|
||||
|
||||
<int:logging-channel-adapter channel="publishInChannel"/>
|
||||
|
||||
<int-jmx:attribute-polling-channel-adapter channel="publishInChannel"
|
||||
server="clientConnector"
|
||||
attribute-name="SendCount"
|
||||
object-name="spring.application:type=MessageChannel,name=twitterChannel">
|
||||
<int:poller fixed-delay="12000"/>
|
||||
</int-jmx:attribute-polling-channel-adapter>
|
||||
|
||||
<int:gateway service-interface="org.springintegration.NotificationListener$Gateway"
|
||||
default-request-channel="commandRouter"/>
|
||||
|
||||
<int:channel id="commandRouter"/>
|
||||
|
||||
<int:router input-channel="commandRouter"
|
||||
expression="payload"
|
||||
default-output-channel="nullChannel"
|
||||
resolution-required="false">
|
||||
<int:mapping value="y" channel="dummyStarter"/>
|
||||
<int:mapping value="n" channel="dummyStopper"/>
|
||||
</int:router>
|
||||
|
||||
<int:channel id="dummyStarter"/>
|
||||
<int:channel id="dummyStopper"/>
|
||||
|
||||
<int-jmx:operation-invoking-channel-adapter channel="dummyStopper"
|
||||
server="clientConnector"
|
||||
operation-name="stop"
|
||||
object-name="spring.application:type=MessageSource,name=dummyAdapter,bean=endpoint" />
|
||||
|
||||
<int-jmx:operation-invoking-channel-adapter channel="dummyStarter"
|
||||
server="clientConnector"
|
||||
operation-name="start"
|
||||
object-name="spring.application:type=MessageSource,name=dummyAdapter,bean=endpoint" />
|
||||
|
||||
</beans>
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<bean id="twitterService" class="org.springintegration.service.impl.DefaultTwitterService"/>
|
||||
|
||||
<int:channel id="twitterChannel">
|
||||
<int:publish-subscribe-channel id="twitterChannel">
|
||||
<int:interceptors>
|
||||
<int:wire-tap channel="logger" />
|
||||
<bean class="org.springintegration.PayloadAwareTimingInterceptor">
|
||||
@@ -61,19 +61,32 @@
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
</int:publish-subscribe-channel>
|
||||
|
||||
<int:publish-subscribe-channel id="logger" />
|
||||
|
||||
<int:logging-channel-adapter id="loggingAdapter" channel="logger" level="INFO"
|
||||
expression="'Id:' + payload.id + '; Date:' + payload.createdAt + '; FromUser: ' + payload.fromUser" />
|
||||
|
||||
<int:bridge input-channel="logger" output-channel="queue"/>
|
||||
<int:bridge id="bridgeToQueueChannel"
|
||||
input-channel="logger" output-channel="queue"/>
|
||||
|
||||
<int:channel id="queue">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int:transformer id="tweetToStringTransformer"
|
||||
input-channel="twitterChannel"
|
||||
output-channel="twitterPublishChannel"
|
||||
expression="'Id:' + payload.id + '; Date:' + payload.createdAt + '; FromUser: ' + payload.fromUser"/>
|
||||
|
||||
<int:channel id="twitterPublishChannel"/>
|
||||
|
||||
<int-jmx:notification-publishing-channel-adapter
|
||||
channel="twitterPublishChannel"
|
||||
default-notification-type="TWEET"
|
||||
object-name="spring.application:type=TweetPublisher,name=tweeter"/>
|
||||
|
||||
<int:channel id="controlBusChannel"/>
|
||||
|
||||
<int:control-bus id="controlBus" input-channel="controlBusChannel"/>
|
||||
|
||||
@@ -1,32 +1,37 @@
|
||||
<?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:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
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/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<!-- Scans within the base package of the application for @Components to configure as beans -->
|
||||
<context:component-scan base-package="org.springframework.integration.mvc.controller" />
|
||||
<!-- Scans within the base package of the application for @Components to
|
||||
configure as beans -->
|
||||
<context:component-scan
|
||||
base-package="org.springframework.integration.mvc.controller" />
|
||||
|
||||
<!-- <mvc:default-servlet-handler /> -->
|
||||
<!-- <mvc:default-servlet-handler /> -->
|
||||
|
||||
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
|
||||
<!-- DispatcherServlet Context: defines this servlet's request-processing
|
||||
infrastructure -->
|
||||
|
||||
<!-- Enables the Spring MVC @Controller programming model -->
|
||||
<mvc:annotation-driven />
|
||||
<!-- Enables the Spring MVC @Controller programming model -->
|
||||
<mvc:annotation-driven />
|
||||
|
||||
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/css directory -->
|
||||
<mvc:resources mapping="/css/**" location="/css/" />
|
||||
<mvc:resources mapping="/js/**" location="/js/" />
|
||||
<!-- Handles HTTP GET requests for /resources/** by efficiently serving
|
||||
up static resources in the ${webappRoot}/css directory -->
|
||||
<mvc:resources mapping="/css/**" location="/css/" />
|
||||
<mvc:resources mapping="/js/**" location="/js/" />
|
||||
|
||||
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
|
||||
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<beans:property name="prefix" value="/WEB-INF/views/" />
|
||||
<beans:property name="suffix" value=".jsp" />
|
||||
</beans:bean>
|
||||
<!-- Resolves views selected for rendering by @Controllers to .jsp resources
|
||||
in the /WEB-INF/views directory -->
|
||||
<beans:bean
|
||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<beans:property name="prefix" value="/WEB-INF/views/" />
|
||||
<beans:property name="suffix" value=".jsp" />
|
||||
</beans:bean>
|
||||
</beans>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p [%.10t][%.10c] %m%n" />
|
||||
<param name="ConversionPattern" value="%d{HH:mm:ss.SSS} %-5p [%t][%c] %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user