activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pollotek <claudio.sant...@gmail.com>
Subject ActiveMQ configuration and Spring Expression Language (SpEL)
Date Tue, 10 Apr 2012 21:17:55 GMT
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:

<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:

<?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/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/context
                          
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                           http://www.springframework.org/schema/jms
                          
http://www.springframework.org/schema/jms/spring-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 -Dactivemq.directory=<my-directory>

On the log I see 
 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 apologize in advance because I'm not sure if this question should be
posted here or Spring's website.

Thanks,
Claudio


--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-configuration-and-Spring-Expression-Language-SpEL-tp4547072p4547072.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message