All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rvicemix.samples.basic.3.2.2.source-code.servicemix.xml Maven / Gradle / Ivy

There is a newer version: 3.4.1
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<!--
    
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You 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.

-->
<beans xmlns="http://xbean.org/schemas/spring/1.0"
	     xmlns:sm="http://servicemix.apache.org/config/1.0"
	     xmlns:jms="http://servicemix.apache.org/jms/1.0"
	     xmlns:amq="http://activemq.org/config/1.0"
	     xmlns:amqra="http://activemq.org/ra/1.0"
	     xmlns:amqpool="http://jencks.org/amqpool/2.0"
       xmlns:jencks="http://jencks.org/2.0"
	     xmlns:my="http://servicemix.apache.org/demo/">


	<!-- the JBI container -->
	<sm:container id="jbi" 
                rootDir="./target/data/smx" 
                useMBeanServer="true"
		            createMBeanServer="true" 
                transactionManager="#transactionManager" 
                flowName="seda"
                autoEnlistInTransaction="true">

		<sm:activationSpecs>

      <!-- 
       ~ This component will receive quartz timers.
       ~ As we use static deployment mode (without Service Units),
       ~ components are started in the order they are declared.
       ~ So we must put this component before the quartz one. 
       ~
       ~ This component is a JMS publisher (role=provider) and
       ~ will publish the message to the "servicemix.source" topic.     
       -->
			<sm:activationSpec componentName="inputSender">
				<sm:component>
				  <jms:component>
				    <jms:endpoints>
				      <jms:endpoint service="my:inputSender" 
                            endpoint="endpoint"
                            role="provider"
                            connectionFactory="#jmsFactory"
                            jmsProviderDestinationName="servicemix.source"
                            destinationStyle="topic" />
            </jms:endpoints>
          </jms:component>
				</sm:component>
			</sm:activationSpec>

			<!--
       ~ This quartz component is configured to fire a timer every 5 seconds.
       ~ JBI exchanges are sent to the "my:inputSender" service defined above.
       -->
			<sm:activationSpec componentName="timer" service="my:timer" destinationService="my:inputSender">
				<sm:component>
					<bean class="org.apache.servicemix.components.quartz.QuartzComponent">
						<property name="triggers">
							<map>
								<entry>
									<key>
										<bean class="org.quartz.SimpleTrigger">
											<property name="repeatInterval" value="5000" />
											<property name="repeatCount" value="-1" />
										</bean>
									</key>
									<bean class="org.quartz.JobDetail">
										<property name="name" value="My Example Job" />
										<property name="group" value="ServiceMix" />
									</bean>
								</entry>
							</map>
						</property>
					</bean>
				</sm:component>
			</sm:activationSpec>

			<!-- 
       ~ This JMS component will subscribe to the "servicemix.source" topic, using JCA.
       ~ It means that the JMS messages will be delivered inside an XA 
       ~ transaction. JBI exchanges will be sent to the "my:outputSender"
       ~ service (which is a JMS producer, so that a JMS bridge is created).  
       -->
			<sm:activationSpec componentName="inputReceiver">
			  <sm:component>
			    <jms:component>
			      <jms:endpoints>
			        <jms:endpoint service="my:outputSender"
                            endpoint="endpoint"
                            role="consumer"
                            processorName="jca"
                            bootstrapContext="#bootstrapContext"
                            resourceAdapter="#activeMQResourceAdapter"
                            connectionFactory="#jmsFactory"
                            defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
                            synchronous="true">
                <jms:activationSpec>
    							<amqra:activationSpec destination="servicemix.source"
                                        destinationType="javax.jms.Topic" />
                </jms:activationSpec>
              </jms:endpoint>
            </jms:endpoints>
          </jms:component>
        </sm:component>
			</sm:activationSpec>

      <!--
       ~ This JMS publisher will publish the JBI exchange
       ~ to the "servicemix.result" topic using JCA.
       -->
			<sm:activationSpec componentName="outputSender">
				<sm:component>
				  <jms:component>
				    <jms:endpoints>
				      <jms:endpoint service="my:outputSender" 
                            endpoint="endpoint"
                            role="provider"
                            processorName="jca"
                            connectionFactory="#jmsFactory"
                            jmsProviderDestinationName="servicemix.result"
                            destinationStyle="topic" />
            </jms:endpoints>
          </jms:component>
				</sm:component>
			</sm:activationSpec>


			<!-- 
       ~ Just to demonstrate that we are sending messages, 
       ~ lets trace the messages we receive.
       ~ So subscribe to the "output" topic and sent the
       ~ exchange to the trace component. 
       -->
			<sm:activationSpec componentName="jmsTrace">
			  <sm:component>
			    <jms:component>
			      <jms:endpoints>
			        <jms:endpoint service="my:jmsTrace"
                            endpoint="endpoint"
                            role="consumer"
                            processorName="jca"
                            targetService="my:trace"
                            bootstrapContext="#bootstrapContext"
                            resourceAdapter="#activeMQResourceAdapter"
                            connectionFactory="#jmsFactory"
                            defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
                            synchronous="true">
                <jms:activationSpec>
    							<amqra:activationSpec destination="servicemix.result"
    								                    destinationType="javax.jms.Topic" />
                </jms:activationSpec>
              </jms:endpoint>
            </jms:endpoints>
          </jms:component>
        </sm:component>
			</sm:activationSpec>

      <!--
       ~ Trace component to display exchanges to the console.
       -->
			<sm:activationSpec componentName="trace" service="my:trace">
				<sm:component>
					<bean class="org.apache.servicemix.components.util.TraceComponent" />
				</sm:component>
			</sm:activationSpec>
		</sm:activationSpecs>
	</sm:container>

  <!-- Transaction Manager -->
	<jencks:transactionManager id="transactionManager" />

  <!-- Work manager -->
  <jencks:workManager
            id="workManager"
            threadPoolSize="25"
            transactionManager="#transactionManager" />
  
  <!-- Bootstrap context for JCA -->
  <jencks:bootstrapContext
            id="bootstrapContext"
            workManager="#workManager"
            transactionManager="#transactionManager" />

	<!-- the JCA Resource Adapter -->
	<amqra:resourceAdapter id="activeMQResourceAdapter" serverUrl="tcp://localhost:61616" />

	<!-- message broker -->
	<amq:broker id="broker" persistent="false">
		<amq:transportConnectors>
			<amq:transportConnector uri="tcp://localhost:61616" />
		</amq:transportConnectors>
	</amq:broker>
	
	<!-- JMS Xa-enabled pooled factory -->
	<amqpool:jcaPooledConnectionFactory 
          name="jmsFactory"
          transactionManager="#transactionManager"
          maxConnections="10"
          brokerURL="tcp://localhost:61616"
          depends-on="broker" />

</beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy