Movatterモバイル変換


[0]ホーム

URL:


Enterprise Integration Patterns

Features > Enterprise Integration Patterns

Enterprise Integration Patterns

Version 5.0 onwards of Apache ActiveMQ Classic comes complete with full support for theEnterprise Integration Patterns (from the excellent book byGregor Hohpe andBobby Woolf) via theApache Camel library.

You can easily add any of the supportedEnterprise Integration Patterns into ActiveMQ Classic (either on the JMS client or in the broker process) to support smart routing, transformation and a whole host of other powerful patterns. You can of course just embedCamel library directly into your application, such as viaSpring as well..

This also means you can cleanly integrate all of theCamel Components into ActiveMQ Classic so you can easily integrate withCXF,Files,JBI,JPA,Mail,MINA,Quartz,XMPP andmany other protocols and transports!

Using EIP in the ActiveMQ Classic Broker

The broker’sactivemq.xml file comes already configured to support Camel; you just need to customize the routing rules.

Writing EIP rules using Java code

To useJava code to write EIP routing rules, just put your classes on the classpath (such as in activemq/lib/myroutes/foo.jar). Then to get Camel to find your routes you need to edit the activemq.xml so that thepackages attribute points to the package name (or a parent package name) to look for.

For example if all your routes are in the packageorg.acme.cheese such asorg.acme.cheese.whatnot.MyRouter then you could edit the XML to be…

<camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <package>org.acme.cheese</package></camelContext>

Writing EIP rules using XML

To use XML its even easier, as you can just embed whatever routing rules inside the<camelContext> element using Camel’sSpring XML format. Note that the XML is way more verbose than theJava DSL but it is a bit simpler to deploy. e.g. for a trivial route…

<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">  <route>    <from uri="activemq:com.acme.MyQueue"/>    <to uri="activemq:com.acme.SomeOtherQueue"/>  </route></camelContext>

Using EIP in the JMS client

You can useCamelEndpoints directly from your JMS client one of the following JMS destinations, depending on what JMS API you want it to use

You can then use this destination like any other JMS destination when sending or receiving messages! This means you can use any of thelarge number of Camel components from your JMS code, by just changing the Destination object!

See Also

Apache, ActiveMQ, Apache ActiveMQ, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. Copyright © 2025, The Apache Software Foundation. Licensed underApache License 2.0.


[8]ページ先頭

©2009-2025 Movatter.jp