Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: ate

...

No matter if the incidents come from a webservice or a files, but before to process and save them in the database, we will put
our messages in the queue of a queue manager. The queue manager used here is ActiveMQ.
Like CXF, we will use spring xml file to deploy ActiveMq into the server and configure it. This will be done in two steps

a) register ActiveMQ

Like CXF, ActiveMq can be installed in the infrastructure using a spring.xml configuration file. So, create the file }} in the directory {{src/main/resources/META-INF/spring and add the following lines.

Code Block

At the bundle startup, Spring will instantiate the beans declared and in consequence start the queueing engine. We haven't changed the content of the file corresponding to what is proposed in the ServiceMix distribution but you can use here the same technic described for the Datasource and add properties that you configure through by example a org.apache.activemq.config.etc file

Code Block

The pom.xml file must be modified to add properties required by Spring blueprint. So add the following lines :

Code Block

b) Camel ActiveMq component

To makes Camel independent of the JMS queue engine deployed in the OSGI server, we will implement a proxy using blueprint service between Camel component and the queuing engine used (Apache ActiveMq, IBM Websphere MQ, Oracle Advance Queue, TIBCO, ...)

First, create a spring DSL containing the following information :

Code Block

<?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:osgi="http://www.springframework.org/schema/osgi"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
                      http://www.springframework.org/schema/beans/spring-beans.xsd
                      http://www.springframework.org/schema/osgi
                      http://www.springframework.org/schema/osgi/spring-osgi.xsd
                      http://camel.apache.org/schema/spring
                      http://camel.apache.org/schema/spring/camel-spring.xsd">
      
    <bean id="active-mq" class="org.apache.activemq.camel.component.ActiveMQComponent" /> (1)

    <osgi:service id="osgiqueuingservice" ref="active-mq" interface="org.apache.camel.Component"/> (2)
       
</beans>

Remarks:
(1) Spring will instantiate the ActiveMqComponent to work with the ActiveMq server. If you would like to use another JMS component, then switch this class to org.apache.camel.component.jms.JmsComponent

(2) Our camel component will be exposed on the OSGI registry as an org.apache.camel.Component and has a reference to the ActiveMQComponent, JMSComponent

Adapt the POM.xml file like this

Code Block

3) Beans reference

4) Routing

Web

Packaging and deployment

...