开发者

JMS fault tolerant asynchronous publisher

In our architecture JMS publisher may continue to work (and generate new messages) even if connection with local network is lost. Is it possible to make publisher server tolerant to network or broker outages with JMS:

  1. publish call may not block application, even if broker is not available;
  2. published messages (during outage) must be delivered after network connection is restored;

As far as I understand it can be done with embedded (local) broker开发者_如何转开发 on each publishing machine. If it's the only way, are there any non obvious problems with that topology - performance, maintenance, etc? Will the local broker be tolerant to outages by itself?


I've not tried this but it seems like you could use local failover to reduce impedance: With ActiveMQ you can configure a failover transport:

failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false

To try and draw this:

client +---> primary: network broker <-------+
       |                                     |
       +---> secondary: embedded broker -----+

Here primary would be your network broker, and your secondary broker would be the locally embedded broker with a bridge to the primary broker. This seems like it would work well when the client publishes allot; I'm not sure if this would be any better for subscribes then the solution put forward by @Biju: illustrated below:

client +---> secondary: embedded broker ------> primary: network broker 

For example here is my embedded broker (which is usually non-persistent).

<bean id="activeMQBroker" class="org.apache.activemq.broker.BrokerService">
    <property name="transportConnectors">
        <list>
                <bean id="brokerConnection" class="org.apache.activemq.broker.TransportConnector">
                    <property name="connectUri">
                        <bean id="brokerURI" class="java.net.URI">
                            <constructor-arg value="tcp://localhost:61616" />
                        </bean>
                    </property>
                </bean>
        </list>
    </property>

    <property name="persistent" value="true" />
</bean>


The only way that I can think of is along the lines you have suggested -

  1. Have a local embedded broker and provide a bridge from this embedded broker to a network based broker. Even the local one can go down though, so you may have to publish transactionally between your resources(db and jms infrastructure)
  2. Do not publish directly, instead have an abstraction which buffers it - to a database, file, or like above to a local embedded jms, and provide a bridge like above from the buffer to the JMS queue.


A distributed architecture if queue managers \ brokers is very common in cases as you describe.

The exact configuration depends on the specific product you use, but it's usually well documented and easy to manage

regarding local redundancy, you may use two such queue manager in a fault tolerant configuration (again - the exact method of creating fault tolerant clusters is product dependent) - but this appears to be some what of an overkill.

JMS standardizes only the API of the message queue provider, other

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜