From the ForwardingBridgeTest, I kind of put this together
quickly...seems to work so far..need to do testing though
let me know if this is the right path
BrokerService brokerBean = (BrokerService)ctx.getBean("broker");
try {
URI localUri = new URI("vm://localhost");
Transport localTransport = TransportFactory.connect(localUri);
URI remoteUri = new URI("tcp://localhost:61616");
Transport remoteTransport = TransportFactory.connect(remoteUri);
ForwardingBridge bridge = new
ForwardingBridge(localTransport,remoteTransport);
bridge.setClientId("local-remote-bridge");
bridge.setDispatchAsync(false);
bridge.start();
Thread.sleep(1000);
}catch(Exception e) {
log.error(e);
}
Marc Dumontier wrote:
Hi,
I had asked this question a while back but never got any responses...I
still really need to figure out how to do this in order to use the
product. Hopefully someone can send me in the right direction
currently, when using spring based config, i can create a network
connector like
<networkConnectors>
<networkConnector uri="static:(tcp://localhost:61616)"
failover="true"/>
</networkConnectors>
From the documentation, I gather this creates a DemandForwardingBridge
- meaning that messages are stored on the local broker until a
consumer (connected to the remote broker) polls for it or something
(store-and-forward?). That's my understanding anyway.
What I need is the ForwardingBridge where messages will be forwarded
immediately from the local broker to the remote broker regardless of
anything else. If the remote broker isn't available, then the local
broker would hang on to the message until the remote broker is
available once again. when the connection is re-established, all
messages queued up on the local broker is forwarded immediately.
Can anyone help me configure this behavior? Can I do it using spring
config..or do i have to create and link the objects in code? btw:I'm
using 4.0
Thanks,
Marc Dumontier