I managed to fix most of the problems with setting dispatchAsync to
true, and adding failover://(...) to the uri.
now i'm getting these everytime i startup up the client
local broker
----------------
java.lang.NullPointerException
at
org.apache.activemq.network.ForwardingBridge.serviceLocalCommand(ForwardingBridge.java:215)
at
org.apache.activemq.network.ForwardingBridge$1.onCommand(ForwardingBridge.java:89)
at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:97)
at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:63)
at
org.apache.activemq.transport.vm.VMTransport.oneway(VMTransport.java:76)
at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:44)
at
org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)
at
org.apache.activemq.broker.TransportConnection.dispatch(TransportConnection.java:211)
at
org.apache.activemq.broker.AbstractConnection.processDispatch(AbstractConnection.java:581)
at
org.apache.activemq.broker.AbstractConnection.iterate(AbstractConnection.java:597)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:110)
at
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunner.java:25)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:534)
Remote Broker
---------------------
INFO Service - Async error occurred:
javax.jms.InvalidClientIDException: Broker: localhost - Client:
local-remote-bridge already connected
javax.jms.InvalidClientIDException: Broker: localhost - Client:
local-remote-bridge already connected
at
org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroker.java:176)
at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:69)
at
org.apache.activemq.advisory.AdvisoryBroker.addConnection(AdvisoryBroker.java:69)
at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:69)
at
org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:82)
at
org.apache.activemq.broker.AbstractConnection.processAddConnection(AbstractConnection.java:507)
at
org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:82)
at
org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:118)
at
org.apache.activemq.broker.AbstractConnection.service(AbstractConnection.java:201)
at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:62)
at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:97)
at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:63)
at
org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:114)
at
org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:122)
at
org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:87)
at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:143)
at java.lang.Thread.run(Thread.java:595)
Marc Dumontier wrote:
Hi,
From what i can tell this is what is happening
CASE 1
------------
1.start remote broker
2.start up client with embedded broker (local broker)
3.start sending messages
Up to here, all is working well...messages are immediately forwarded
to remote broker
4. kill remote broker
Messages are queuing up in local broker as expected
5. start up remote broker
Messages continue to queue up in local broker...no reconnection occurs
CASE 2
------------
1. start up remote broker
2. start up client (currently has queued messages in local broker)
messages are sent to remote broker, *but* queued messages in local
broker don't get forwarded
Case 3
-----------
1. start up client
ConnectionRefused exception occurs. What I'd like to see is for the
client to keep trying to connect to the remote broker with no
exception thrown. what is the best pattern (or URI parameter?) to
achieve this.
Thanks Again,
Marc
Marc Dumontier wrote:
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