Hi James,
Thank you very much for your help.
Although I'm going to keep this email somewhere for future use, there is
actually a much easier way of doing this. The activemq.xml already accepts
to use system environments variable as if inside the file.
I just needed to use: brokerName="${COMPUTERNAME}" to archive the desired
goal. (%COMPUTERNAME% is the system environment variable in windows that
contains the hostname. My problem was that i was using hostname, which also
returns the hostname in dos, but is not a system environment variable).
Thank you very much for your help, I learned how to use other variables than
the system's ones into my config file.
Have a nice day ahead,
Sebastian

2009/12/4 James Casey <jamesc....@gmail.com>

> Hi Sebastian,
>
> An easy way is to modify the bin/activemq script to pass across an
> activemq.hostname parameter.
>
> e.g.  in bin/activemq, add:
>
> ACTIVEMQ_HOSTNAME=`hostname -f`
>
> and then in the line :
>
> exec "$JAVACMD" $ACTIVEMQ_DEBUG_OPTS $ACTIVEMQ_OPTS
> -Dactivemq.classpath="${
> ACTIVEMQ_CLASSPATH}" -Dactivemq.home="${ACTIVEMQ_HOME}"
> -Dactivemq.base="${ACTIV
> EMQ_BASE}" -jar "${ACTIVEMQ_HOME}/bin/run.jar" start $@
>
>
> add in  "-Dactivemq.hostname=${ACTIVEMQ_HOSTNAME} ".
>
>
> If you use Java Wrapper and an init.d you can do a similar logic - set
> the hostname in the init.d script as before, and in the wrapper.conf
> do something like:
>
> wrapper.java.additional.3=-Dactivemq.hostname=%ACTIVEMQ_HOSTNAME%
>
> We use the second method in production successfully.
>
> cheers,
>
> James.
>
>
> 2009/12/4 Sebastian Rodriguez <srodrig...@gmail.com>:
> > Dear all,
> > In need your advice in the following configuration scenario: we are
> > deploying ActiveMQ 5.3 in a big number of machines. The configuration is
> > exactly the same for all the machines, the only difference is, of course,
> > the broker name. As they need to be unique, they need to be changed in
> all
> > the machines, creating a very repetitive yet time consuming task that
> would
> > be to modify the activemq.xml file.
> > Is there a way to use a environment variables in the configuration file
> (to
> > put the hostname of the machine as the broker name)?
> > I see there is already some configuration possible through the
> > eg.springframework.beans.factory.config.PropertyPlaceholderConfigurer
> class,
> > but those properties are static. I guess I can create a deploy script
> that
> > created my own properties file that will put the hostname in it, but that
> > property would only be created or refreshed when I deploy the service.
> > This is not the ideal solution as the hostname might change in the
> machine
> > life, so I'm seeking for your advice in the matter.
> > Thank you very much for your help,
> > --
> > Sebastien Rodriguez
> >
>



-- 
Sebastien Rodriguez

Reply via email to