activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Co <>
Subject Re: Newbie configuration questions
Date Tue, 21 Nov 2006 22:38:22 GMT

Here's my two cents. See inlined. :)

ktrue wrote:
> Hi all,
> First off: to the developers of ActiveMQ - thanks for all the hard work!
> It's a great product!
> One of the strengths of ActiveMQ is the array of options for configuration,
> the flexibility of topology, and so forth. Unfortunately, with all these
> options from which to choose I'm not sure that I'm configuring my system in
> the correct -- let alone optimal -- fashion.
> My system uses a very generic client/server topology. I have a web
> application that acts as a server to N clients that send messages to that
> server.
> I've configured (via Spring 1.2.x) the server to contain an embedded broker
> thusly:
>     <bean id="jmsBroker" 
>       class="" 
>       init-method="start" 
>       destroy-method="stop">
>         <property name="brokerName" value="adminserver"/>
>         <property name="persistenceAdapter"><ref
> local="persistenceAdapter"/></property>
>         <property name="useJmx" value="false"/>
>         <property name="useShutdownHook" value="false"/>
>         <property name="transportConnectorURIs">
>             <list>
>                 <value>tcp://localhost:61616</value>
>             </list>
>         </property>
>     </bean>
>     <bean id="jencks" class="org.jencks.JCAContainer"
> depends-on="jmsBroker">
>         <property name="bootstrapContext">
>             <bean class="org.jencks.factory.BootstrapContextFactoryBean">
>                 <property name="threadPoolSize"><value>25</value></property>
>             </bean>
>         </property>
>         <property name="resourceAdapter">
>             <bean id="activeMQResourceAdapter"
> class="org.apache.activemq.ra.ActiveMQResourceAdapter">
>                 <property name="serverUrl" value="vm://adminserver"/>
>             </bean>
>         </property>
>     </bean>
> Client:
>     <bean id="jmsConnectionFactory"
>       class="org.apache.activemq.pool.PooledConnectionFactory"
>       init-method="start"
>       destroy-method="stop">
>         <property name="connectionFactory">
>             <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>                 <property name="brokerURL"
> value="failover:(tcp://${adminserver}:61616)"/>
>             </bean>
>         </property>
>     </bean>
> Here are my questions:
>     1. Is this "correct"? It seems to work as expected, but I'm not sure if
> this is the correct way to do it. Specifically,
>         does this scheme allow for failover when the server goes offline but
> eventually comes back up? Is there a 
>         need to use a 'network of brokers' for some reason and embed brokers
> in the client?
yes, the clients will keep retrying to connect to the broker because of 
the failover protocol.
>     2. In the above configuration, I have successfully noted that I can
> start the clients BUT NOT THE SERVER
>         and the JMS layer appears to queue up the messages such that when
> the server does start, all of the 
>         messages are then sent to and received on the server. This is
> fantastic, but, how does that work? I'd like to
>         know if this is a design feature, how it works, if there are any
> parameters, what the limitations are, etc.
Basically, using the failover protocol the clients will keep trying to 
connect to the broker until it is successful. In the case of not 
starting the broker yet, it is similar to the broker crashing, so 
clients will keep trying until it is upped. Details and config here:
>     3. The previous developers on the project used a network of brokers
> topology and had a broker in
>         each of the clients as well. However, when the client's JMS
> connection factory used a failover:(vm://client)
>         transport for the brokerURL, it never actually worked. When the
> server went offline and came back online
>         it would never reconnect. Given my current understanding (admittedly
> shallow), I don't see the need/benefit
>         of embedding brokers in the client except that (in relation to
> question 2), there are configuration options for
>         persistence of messages. Is there something I'm missing.
For me, one of the key use of embedding brokers in the client, is that 
clients can continue processing stuff even when the remote broker is 
down. AFAIK, using the failover protocol, will block the sending of a 
message until the client is able reconnect to the broker. If you use an 
embedded broker, messages will be persisted automatically, and be sent 
when the remote broker comes online again, and the actual producer need 
not worry about it. I don't think theres not much use for a 
failover:vm://client as using an embedded broker assumes that if a 
broker goes down, the client in essence is also down.

> Forgive me if I missed a critical point of explanation or am asking silly
> questions. I've done a good amount of research but am still lacking a basic
> understanding of some of these points.
> Thanks!
> Kirk

View raw message