Fixed consumer channel selection and added better exception logging

This commit is contained in:
Simon Pamies committed 2013-06-19 18:52:10 +02:00
1 parent 4539a19cb0
commit b23ae0defb
2 files changed
+10 -2

No files matched your search

@@ -48,7 +48,7 @@ public class ReplicationMasterDescriptorImpl implements ReplicationMasterDescrip
connectionFactory.setPort(port);
}
Connection connection = connectionFactory.newConnection();
Channel channel = connection.createChannel(0);
Channel channel = connection.createChannel();
channel.exchangeDeclare(exchangeName, "fanout");
QueueingConsumer consumer = new QueueingConsumer(channel);
String queueName = channel.queueDeclare().getQueue();
@@ -181,7 +181,15 @@ public class ReplicationServiceImpl implements ReplicationService, OperationExec
logger.info("Starting to replicate from "+master);
replicatingFromMaster = master;
registerReplicaWithMaster(master);
QueueingConsumer consumer = master.getConsumer();
logger.info("Registered replica with master");
QueueingConsumer consumer = null;
try {
consumer = master.getConsumer();
} catch (Exception ex) {
ex.printStackTrace();
throw ex;
}
logger.info("Connection to exchange successful.");
URL initialLoadURL = master.getInitialLoadURL();
logger.info("Initial load URL is "+initialLoadURL);
final Replicator replicator = new Replicator(master, this, /* startSuspended */ true, consumer);