Activemq -- XML reference

Source: Internet
Author: User
Tags amq
Document directory
  • Related Solutions
  • Note: namespace
  • Template verification-XML elements are sorted by character
XML reference activemq XML reference

This page contains the link to the XML reference wizard and the template document of the XML configuration accompanied by the activemq release.

Related Solutions

References

Reference

XML template

XML template namespace

Xbean XML reference 4.1

Reference

Http://activemq.apache.org/schema/core/activemq-core-4.1.2.xsd

Http://activemq.org/config/1.0

Xbean XML reference 5.0

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd

Http://activemq.org/config/1.0

Xbean XML reference 5.1

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.1.0.xsd

Http://activemq.apache.org/schema/core

Xbean XML reference 5.2

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd

Http://activemq.apache.org/schema/core

Xbean XML reference 5.3.0

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd

Http://activemq.apache.org/schema/core

Xbean XML reference 5.3.1

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.3.1.xsd

Http://activemq.apache.org/schema/core

Xbean XML reference 5.3.2

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.3.2.xsd

Http://activemq.apache.org/schema/core

Xbean XML reference 5.4.0

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.4.0.xsd

Http://activemq.apache.org/schema/core

Xbean XML reference 5.4.1

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.4.1.xsd

Http://activemq.apache.org/schema/core

Xbean XML reference 5.4.2

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.4.2.xsd

Http://activemq.apache.org/schema/core

Xbean XML reference 5.5.0

Reference

Http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd

Http://activemq.apache.org/schema/core

 

Use XSD in the configuration file

If you use xbean to parse the xml configuration file, XML acceptance is an option so that you do not need to specify the location of the XML template. However, if you use spring2.0xml to process and parse XML, You need to define the XSD location in your XML document, because spring uses the template namespace or template location to parse the processing of the namespace.

Unable to locate namespacehandler fornamespace [http://activemq.org/config/1.0]

You can reference a specified version of XSD in XML, as shown below:

<Beansxmlns = "http://www.springframework.org/schema/beans"

Xmlns: AMQ = "http://activemq.org/config/1.0"

Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"

Xsi: schemalocation ="

Http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd

Http://activemq.org/config/1.0
Http://activemq.apache.org/schema/core/activemq-core-4.1.2.xsd>

Or you prefer to use the general XSD instead of the specified version number, as shown below:

<Beansxmlns = "http://www.springframework.org/schema/beans"

Xmlns: AMQ = "http://activemq.org/config/1.0"

Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"

Xsi: schemalocation ="

Http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd

Http://activemq.org/config/1.0
Http://activemq.apache.org/schema/activemq-core.xsd>

If your ide cannot obtain this XSD, You need to manually connect to the specified release. This means that you do not have to update your xml configuration file in the release of activemq. Because it uses the XSD bound in the activemq-core.jar.

Note: namespace

If you use activemq5.0 or earlier, your xml namespace definition should point to http://activemq.org/config/1.0. If you use version 5.1 or later, your namespace should pointHttp://activemq.apache.org/schema/core.. As shown below.

Activemq5.2 example

<Beansxmlns = "http://www.springframework.org/schema/beans"

Xmlns: AMQ = "http://activemq.apache.org/schema/core"

Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"

Xsi: schemalocation ="

Http://www.springframework.org/schema/beans

Http://www.springframework.org/schema/beans/spring-beans.xsd

Http://activemq.apache.org/schema/core

Http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd

">

</Beans>

Activemq5.0 example

<Beansxmlns = "http://www.springframework.org/schema/beans"

Xmlns: AMQ = "http://activemq.org/config/1.0"

Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"

Xsi: schemalocation ="

Http://www.springframework.org/schema/beans

Http://www.springframework.org/schema/beans/spring-beans.xsd

Http://activemq.org/config/1.0

Http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd

">

</Beans>

The two examples above are almost the same, and the difference is only in the namespace. You can find more detailed information in the activemq-dev topic: Change the namespace of activemq.

Template verification-XML elements are sorted by character

Note: Starting from activemq 5.4.2, you can enter the xbean URL parameter in the command line to disable verification. This allows you to use an existing xml configuration file.

Bin/activemq export lexbean: CONF/activemq. xml? Validate = false

Starting from activemq 5.4, the XML elements in the <broker> element must be sorted by character. If you view the XSD file, it seems that there is no change. The difference is that starting from 5.4, the xml configuration file actually verifies the XML target.

For example, the following xml configuration file is correct in 5.3.x.

<? XML version = "1.0"?>

<Beansxmlns = "http://www.springframework.org/schema/beans" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"

Xsi: schemalocation = "http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd

Http://activemq.apache.org/schema/corehttp://activemq.apache.org/schema/core/activemq-core.xsd

Http://camel.apache.org/schema/springhttp://camel.apache.org/schema/spring/camel-spring.xsd>

<Broker xmlns = "http://activemq.apache.org/schema/core" brokername = "brokerb1" destroyapplicationcontextonstop = "true">

<Plugins>

<Loggingbrokerplugin/>

</Plugins>

<Persistenceadapter>

<Kahadb directory = "$ {activemq. Base}/data/kahadb" enablejournaldisksyncs = "false" indexwritebatchsize = "10000" indexcachesize = "1000"/>

</Persistenceadapter>

<Destinationpolicy>

<Policymap>

<Policyentries>

<Policyentry queue = ">" producerflowcontrol = "true" memorylimit = "5 MB">

<Deadletterstrategy>

<Individualdeadletterstrategyqueueprefix = "dlq." usequeueforqueuemessages = "true"/>

</Deadletterstrategy>

</Policyentry>

</Policyentries>

</Policymap>

</Destinationpolicy>

<Managementcontext>

<Managementcontext createconnector = "false"/>

</Managementcontext>

<Systemusage>

<Systemusage>

<Memoryusage>

<Memoryusage Limit = "420 Mbit/s"/>

</Memoryusage>

<Storeusage>

<Storeusage Limit = "1 GB"/>

</Storeusage>

<Tempusage>

<Tempusage Limit = "250 MB"/>

</Tempusage>

</Systemusage>

</Systemusage>

<Transportors ors>

<Transportctor name = "TCP" uri = "TCP: // 0.0.0.0: 61616"/>

</Transportors ors>

</Broker>

</Beans>

However, in 5.4, it triggers an exception, as shown below:

Caused by: Org. XML. sax. saxparseexception: cvc-complex-type.2.4.a: Invalid Content was found starting with element 'persistenceadapter '. one of '{"http://activemq.apache.org/schema/core": producersystemusage, "http://activemq.apache.org/schema/core": proxyconnectors, "http://activemq.apache.org/schema/core": regionbroker, "http://activemq.apache.org/schema/core": services, "http://activemq.apache.org/schema/core": shutdownhooks, "http://activemq.apache.org/schema/core": sslcontext, "http://activemq.apache.org/schema/core": systemusage, "http://activemq.apache.org/schema/core": taskrunnerfactory, "http://activemq.apache.org/schema/core": tempdatastore,
"Http://activemq.apache.org/schema/core": transportconnectoruris, "http://activemq.apache.org/schema/core": transportors ors, WC [# Other: "http://activemq.apache.org/schema/core"]} 'is expected.

To avoid such errors in 5.4, you only need to simply change the order of XML elements and arrange them in character order. For example, the following sequence is arranged.

<? XML version = "1.0"?>

<Beansxmlns = "http://www.springframework.org/schema/beans" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"

Xsi: schemalocation = "http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd

Http://activemq.apache.org/schema/corehttp://activemq.apache.org/schema/core/activemq-core.xsd

Http://camel.apache.org/schema/springhttp://camel.apache.org/schema/spring/camel-spring.xsd>

<Broker xmlns = "http://activemq.apache.org/schema/core" brokername = "brokerb1" destroyapplicationcontextonstop = "true">

<Destinationpolicy>

<Policymap>

<Policyentries>

<Policyentry queue = ">" producerflowcontrol = "true" memorylimit = "5 MB">

<Deadletterstrategy>

<Individualdeadletterstrategyqueueprefix = "dlq." usequeueforqueuemessages = "true"/>

</Deadletterstrategy>

</Policyentry>

</Policyentries>

</Policymap>

</Destinationpolicy>

<Managementcontext>

<Managementcontextcreateconnector = "false"/>

</Managementcontext>

 

<Persistenceadapter>

<Kahadb directory = "$ {activemq. Base}/data/kahadb" enablejournaldisksyncs = "false" indexwritebatchsize = "10000" indexcachesize = "1000"/>

</Persistenceadapter>

 

<Plugins>

<Loggingbrokerplugin/>

</Plugins>

<Systemusage>

<Systemusage>

<Memoryusage>

<Memoryusage Limit = "420 Mbit/s"/>

</Memoryusage>

<Storeusage>

<Storeusage Limit = "1 GB"/>

</Storeusage>

<Tempusage>

<Tempusage Limit = "250 MB"/>

</Tempusage>

</Systemusage>

</Systemusage>

<Transportors ors>

<Transportctor name = "TCP" uri = "TCP: // 0.0.0.0: 61616"/>

</Transportors ors>

</Broker>

</Beans>

You can use the startup script of activemq to easily test activemq 5.4, as shown below:

$ CD $ activemq_home
$./Bin/activemq console xbean: file:/users/bsnyder/springsource/clients/Finra/activemq-example-unordered.xml
Info: Using default configuration
(You can configure options in one of these file:/etc/default/activemq/users/bsnyder/. activemqrc)

Info: invoke the following command tocreate a configuration file
./Bin/activemq setup [/etc/default/activemq |/users/bsnyder/. activemqrc]

Info: using Java '/system/library/frameworks/JavaVM. Framework/home/bin/Java'
Info: starting in foreground, this is just for debugging purposes (stop processBy pressing CTRL + C)
Java runtime: Apple Inc. 1.6.0 _ 20/system/library/frameworks/JavaVM. Framework/versions/1.6.0/home
Heap sizes: Current = 258880 K free = 253106 K max = 258880 K
JVM ARGs:-xms256m-Xmx256M-Dorg.apache.activemq.UseDedicatedTaskRunner = true-djava. util. logging. config. file = logging. properties-Dcom.sun.management.jmxremote-Dactivemq.classpath =/users/bsnyder/AMQ/apache-activemq-5.4.1/conf;-dactivemq. home =/users/bsnyder/AMQ/apache-activemq-5.4.1-Dactivemq.base =/users/bsnyder/AMQ/apache-activemq-5.4.1
Activemq_home:/users/bsnyder/AMQ/apache-activemq-5.4.1
Activemq_base:/users/bsnyder/AMQ/apache-activemq-5.4.1
Loading message broker from: xbean: file:/users/bsnyder/springsource/clients/Finra/activemq-example-unordered.xml
...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.