fixed mq config

This commit is contained in:
七锋
2018-10-28 21:15:57 +08:00
parent c36a51b8e3
commit 071545987b
8 changed files with 39 additions and 32 deletions

View File

@@ -12,7 +12,7 @@ import java.util.Map;
*/
public class MQProperties {
private String servers = "localhost:6667";
private String servers = "127.0.0.1:6667";
private int retries = 0;
private int batchSize = 16384;
private int lingerMs = 1;
@@ -20,7 +20,7 @@ public class MQProperties {
private boolean filterTransactionEntry = true;
private String producerGroup = "Canal-Producer";
private int canalBatchSize = 50;
private Long canalGetTimeout;
private Long canalGetTimeout = 100L;
private boolean flatMessage = true;
private List<CanalDestination> canalDestinations = new ArrayList<CanalDestination>();

View File

@@ -121,15 +121,14 @@ public class CanalMQStarter {
server.subscribe(clientIdentity);
logger.info("## the canal consumer {} is running now ......", destination.getCanalDestination());
Long getTimeout = properties.getCanalGetTimeout();
int getBatchSize = properties.getCanalBatchSize();
while (running) {
Message message;
if (properties.getCanalGetTimeout() != null) {
message = server.getWithoutAck(clientIdentity,
properties.getCanalBatchSize(),
properties.getCanalGetTimeout(),
TimeUnit.MILLISECONDS);
if (getTimeout != null && getTimeout > 0) {
message = server.getWithoutAck(clientIdentity, getBatchSize, getTimeout, TimeUnit.MILLISECONDS);
} else {
message = server.getWithoutAck(clientIdentity, properties.getCanalBatchSize());
message = server.getWithoutAck(clientIdentity, getBatchSize);
}
final long batchId = message.getId();