activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: embedding ActiveMQ thanks activemq.xml without starting
Date Tue, 07 Apr 2009 15:56:27 GMT
indicate the to broker (XBeanBrokerService) that it should not start:

add start="false" as in:

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="Test"
dataDirectory="${activemq.base}/data" start="false">

then you are free to call start from code.


2009/4/7 ffrenchm <ffrench.mathilde@gmail.com>

>
> Hello,
>
> the content of my xml file :
>
> <!--
>    Licensed to the Apache Software Foundation (ASF) under one or more
>    contributor license agreements.  See the NOTICE file distributed with
>    this work for additional information regarding copyright ownership.
>    The ASF licenses this file to You under the Apache License, Version 2.0
>    (the "License"); you may not use this file except in compliance with
>    the License.  You may obtain a copy of the License at
>
>    http://www.apache.org/licenses/LICENSE-2.0
>
>    Unless required by applicable law or agreed to in writing, software
>    distributed under the License is distributed on an "AS IS" BASIS,
>    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>    See the License for the specific language governing permissions and
>    limitations under the License.
> -->
> <!-- START SNIPPET: example -->
> <beans
>  xmlns="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-2.0.xsd
>  http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core.xsd
>  http://activemq.apache.org/camel/schema/spring
> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
>
>    <!-- Allows us to use system properties as variables in this
> configuration file -->
>    <bean
>
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>         <property name="locations">
>
> <value>file:///${activemq.base}/conf/credentials.properties</value>
>         </property>
>    </bean>
>
>    <broker xmlns="http://activemq.apache.org/schema/core"
> brokerName="Test"
> dataDirectory="${activemq.base}/data">
>
>        <!-- Destination specific policies using destination names or
> wildcards -->
>        <destinationPolicy>
>            <policyMap>
>                <policyEntries>
>                    <policyEntry queue=">" memoryLimit="5mb"/>
>                    <policyEntry topic=">" memoryLimit="5mb">
>                      <!-- you can add other policies too such as these
>                        <dispatchPolicy>
>                            <strictOrderDispatchPolicy/>
>                        </dispatchPolicy>
>                        <subscriptionRecoveryPolicy>
>                            <lastImageSubscriptionRecoveryPolicy/>
>                        </subscriptionRecoveryPolicy>
>                      -->
>                    </policyEntry>
>                </policyEntries>
>            </policyMap>
>        </destinationPolicy>
>
>        <!-- Use the following to configure how ActiveMQ is exposed in JMX
> -->
>        <managementContext>
>            <managementContext createConnector="false"/>
>        </managementContext>
>
>        <!-- The store and forward broker networks ActiveMQ will listen to
> -->
>        <networkConnectors>
>            <!-- by default just auto discover the other brokers -->
>            <networkConnector name="default-nc" uri="multicast://default"/>
>            <!-- Example of a static configuration:
>            <networkConnector name="host1 and host2"
> uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
>            -->
>        </networkConnectors>
>
>        <persistenceAdapter>
>            <amqPersistenceAdapter syncOnWrite="false"
> directory="${activemq.base}/data" maxFileLength="20 mb"/>
>        </persistenceAdapter>
>
>        <!-- Use the following if you wish to configure the journal with
> JDBC -->
>        <!--
>        <persistenceAdapter>
>            <journaledJDBC dataDirectory="${activemq.base}/data"
> dataSource="#postgres-ds"/>
>        </persistenceAdapter>
>        -->
>
>        <!-- Or if you want to use pure JDBC without a journal -->
>        <!--
>        <persistenceAdapter>
>            <jdbcPersistenceAdapter dataSource="#postgres-ds"/>
>        </persistenceAdapter>
>        -->
>
>        <sslContext>
>            <sslContext keyStore="file:${activemq.base}/conf/broker.ks"
> keyStorePassword="password"
> trustStore="file:${activemq.base}/conf/broker.ts"
> trustStorePassword="password"/>
>        </sslContext>
>
>        <!--  The maximum about of space the broker will use before slowing
> down producers -->
>        <systemUsage>
>            <systemUsage>
>                <memoryUsage>
>                    <memoryUsage limit="20 mb"/>
>                </memoryUsage>
>                <storeUsage>
>                    <storeUsage limit="1 gb" name="foo"/>
>                </storeUsage>
>                <tempUsage>
>                    <tempUsage limit="100 mb"/>
>                </tempUsage>
>            </systemUsage>
>        </systemUsage>
>
>
>        <!-- The transport connectors ActiveMQ will listen to -->
>        <transportConnectors>
>            <transportConnector name="openwire" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>            <transportConnector name="ssl" uri="ssl://localhost:61617"/>
>        </transportConnectors>
>
>    </broker>
> </beans>
> <!-- END SNIPPET: example -->
>
> I decided to embed activemq by setting the configuration through internal
> API. But maybe should I throw a JIRA for this issue ?
>
>
> Gary Tully wrote:
> >
> > that seems unintended, what is the contents of you xml configuration
> file?
> >
> > There are some alternatives that may help: see:
> >
> http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html
> >
> > 2009/4/6 ffrenchm <ffrench.mathilde@gmail.com>
> >
> >>
> >> Hello,
> >>
> >> I'm trying to embed ActiveMQ thanks this method call:
> >>
> >> broker = BrokerFactory.createBroker(new URI("xbean:file:"+conffile_),
> >> false);
> >>
> >> As far I can understand by setting the boolean startBroker to false it
> >> should not start the broker until I expressly implement the
> >> broker.start()
> >> method but in fact it did (broker.isStarted() return true)...
> >>
> >> Do I misunderstand or is this a unattended behavior ?
> >>
> >> Thanks
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/embedding-ActiveMQ-thanks-activemq.xml-without-starting-tp22906914p22906914.html
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > http://blog.garytully.com
> >
> > Open Source SOA
> > http://FUSESource.com
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/embedding-ActiveMQ-thanks-activemq.xml-without-starting-tp22906914p22927685.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source SOA
http://FUSESource.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message