Announcement Announcement Module
Collapse
No announcement yet.
ActiveMQ configuration and Spring Expression Language (SpEL) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ActiveMQ configuration and Spring Expression Language (SpEL)

    I have to start multiple instances (separate JVMs) of this one service on the same machine which has a persistent embedded broker. All config files are pre-generated and have their variable substitutions done on compilation way before the services start. I'm having problems with several instances trying to get a lock of AMQ data directory and KahaDB, obviously the 1st instance successfully gets the lock and the rest keep on trying unsuccessfully.

    I need to set something like this:

    Code:
    ...
    <amq:broker dataDirectory="${activemq.directory}/data" id="broker" persistent="true" useJmx="false" >
    ...
    I tried PropertyPlaceholderConfigurer but as I understand it loads the properties from a file specified in Spring configuration and at the time it starts up is too late already. I'm trying to use Spring Expression Language so I end up with something like this:

    Code:
    <?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:p="http://www.springframework.org/schema/p"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:jms="http://www.springframework.org/schema/jms"
           xmlns:amq="http://activemq.apache.org/schema/core"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
                               http://www.springframework.org/schem...ring-beans.xsd
                               http://www.springframework.org/schema/context
                               http://www.springframework.org/schem...-beans-3.0.xsd
                               http://www.springframework.org/schema/jms
                               http://www.springframework.org/schem...ng-jms-3.0.xsd
                               http://activemq.apache.org/schema/core
                               http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">
    
    
       
        <amq:broker dataDirectory="#{systemProperties['activemq.directory']}/data" id="broker" persistent="true" useJmx="false" > 
    ...
    I pass on the command line

    Code:
    -Dactivemq.directory=<my-directory>
    On the log I see

    Code:
    ... nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '{systemProperties['activemq.directory']}/data' is defined ...
    Does it seem like I'm missing something with AMQ and Spring3 SpEL? Is there some other Solution AMQ offers that can substitute variables on the fly given command line property params? I'm obviously including org.springframework.expression-3.0.5.RELEASE.jar in my classpath

    UPDATE

    I just ended up using simply PropertyPlaceholderConfigurer and it works just fine.
    Last edited by [email protected]; Apr 11th, 2012, 05:01 PM.
Working...
X