Package com.alibaba.otter.canal.protocol.CanalPacket

Examples of com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback


        }
    }

    public void rollback(long batchId) throws CanalClientException {
        waitClientRunning();
        ClientRollback ca = ClientRollback.newBuilder().setDestination(clientIdentity.getDestination()).setClientId(String.valueOf(clientIdentity.getClientId())).setBatchId(batchId).build();
        try {
            writeWithHeader(channel,
                            Packet.newBuilder().setType(PacketType.CLIENTROLLBACK).setBody(ca.toByteString()).build().toByteArray());
        } catch (IOException e) {
            throw new CanalClientException(e);
        }
    }
View Full Code Here


        }
    }

    public void rollback(long batchId) throws CanalClientException {
        waitClientRunning();
        ClientRollback ca = ClientRollback.newBuilder().setDestination(clientIdentity.getDestination()).setClientId(
                                                                                                                    String.valueOf(clientIdentity.getClientId())).setBatchId(
                                                                                                                                                                             batchId).build();
        try {
            writeWithHeader(
                            channel,
                            Packet.newBuilder().setType(PacketType.CLIENTROLLBACK).setBody(ca.toByteString()).build().toByteArray());
        } catch (IOException e) {
            throw new CanalClientException(e);
        }
    }
View Full Code Here

        }
    }

    public void rollback(long batchId) throws CanalClientException {
        waitClientRunning();
        ClientRollback ca = ClientRollback.newBuilder().setDestination(clientIdentity.getDestination()).setClientId(String.valueOf(clientIdentity.getClientId())).setBatchId(batchId).build();
        try {
            writeWithHeader(channel,
                            Packet.newBuilder().setType(PacketType.CLIENTROLLBACK).setBody(ca.toByteString()).build().toByteArray());
        } catch (IOException e) {
            throw new CanalClientException(e);
        }
    }
View Full Code Here

                                         MessageFormatter.format("destination or clientId is null", ack.toString()).getMessage(),
                                         ctx.getChannel(), null);
                    }
                    break;
                case CLIENTROLLBACK:
                    ClientRollback rollback = CanalPacket.ClientRollback.parseFrom(packet.getBody());
                    MDC.put("destination", rollback.getDestination());
                    if (StringUtils.isNotEmpty(rollback.getDestination())
                        && StringUtils.isNotEmpty(rollback.getClientId())) {
                        clientIdentity = new ClientIdentity(rollback.getDestination(),
                                                            Short.valueOf(rollback.getClientId()));
                        if (rollback.getBatchId() == 0L) {
                            embededServer.rollback(clientIdentity);// 回滚所有批次
                        } else {
                            embededServer.rollback(clientIdentity, rollback.getBatchId()); // 只回滚单个批次
                        }
                    } else {
                        NettyUtils.error(401, MessageFormatter.format("destination or clientId is null",
                                                                      rollback.toString()).getMessage(),
                                         ctx.getChannel(), null);
                    }
                    break;
                default:
                    NettyUtils.error(
View Full Code Here

        }
    }

    public void rollback(long batchId) throws CanalClientException {
        waitClientRunning();
        ClientRollback ca = ClientRollback.newBuilder()
            .setDestination(clientIdentity.getDestination())
            .setClientId(String.valueOf(clientIdentity.getClientId()))
            .setBatchId(batchId)
            .build();
        try {
            writeWithHeader(channel, Packet.newBuilder()
                .setType(PacketType.CLIENTROLLBACK)
                .setBody(ca.toByteString())
                .build()
                .toByteArray());
        } catch (IOException e) {
            throw new CanalClientException(e);
        }
View Full Code Here

        }
    }

    public void rollback(long batchId) throws CanalClientException {
        waitClientRunning();
        ClientRollback ca = ClientRollback.newBuilder().setDestination(clientIdentity.getDestination()).setClientId(
                                                                                                                    String.valueOf(clientIdentity.getClientId())).setBatchId(
                                                                                                                                                                             batchId).build();
        try {
            writeWithHeader(
                            channel,
                            Packet.newBuilder().setType(PacketType.CLIENTROLLBACK).setBody(ca.toByteString()).build().toByteArray());
        } catch (IOException e) {
            throw new CanalClientException(e);
        }
    }
View Full Code Here

        }
    }

    public void rollback(long batchId) throws CanalClientException {
        waitClientRunning();
        ClientRollback ca = ClientRollback.newBuilder()
            .setDestination(clientIdentity.getDestination())
            .setClientId(String.valueOf(clientIdentity.getClientId()))
            .setBatchId(batchId)
            .build();
        try {
            writeWithHeader(channel, Packet.newBuilder()
                .setType(PacketType.CLIENTROLLBACK)
                .setBody(ca.toByteString())
                .build()
                .toByteArray());
        } catch (IOException e) {
            throw new CanalClientException(e);
        }
View Full Code Here

                                         MessageFormatter.format("destination or clientId is null", ack.toString()).getMessage(),
                                         ctx.getChannel(), null);
                    }
                    break;
                case CLIENTROLLBACK:
                    ClientRollback rollback = CanalPacket.ClientRollback.parseFrom(packet.getBody());
                    MDC.put("destination", rollback.getDestination());
                    if (StringUtils.isNotEmpty(rollback.getDestination())
                        && StringUtils.isNotEmpty(rollback.getClientId())) {
                        clientIdentity = new ClientIdentity(rollback.getDestination(),
                                                            Short.valueOf(rollback.getClientId()));
                        if (rollback.getBatchId() == 0L) {
                            embededServer.rollback(clientIdentity);// 回滚所有批次
                        } else {
                            embededServer.rollback(clientIdentity, rollback.getBatchId()); // 只回滚单个批次
                        }
                    } else {
                        NettyUtils.error(401,
                                         MessageFormatter.format("destination or clientId is null", rollback.toString()).getMessage(),
                                         ctx.getChannel(), null);
                    }
                    break;
                default:
                    NettyUtils.error(400,
View Full Code Here

        }
    }

    public void rollback(long batchId) throws CanalClientException {
        waitClientRunning();
        ClientRollback ca = ClientRollback.newBuilder().setDestination(clientIdentity.getDestination()).setClientId(
                                                                                                                    String.valueOf(clientIdentity.getClientId())).setBatchId(
                                                                                                                                                                             batchId).build();
        try {
            writeWithHeader(
                            channel,
                            Packet.newBuilder().setType(PacketType.CLIENTROLLBACK).setBody(ca.toByteString()).build().toByteArray());
        } catch (IOException e) {
            throw new CanalClientException(e);
        }
    }
View Full Code Here

                                         MessageFormatter.format("destination or clientId is null", ack.toString()).getMessage(),
                                         ctx.getChannel(), null);
                    }
                    break;
                case CLIENTROLLBACK:
                    ClientRollback rollback = CanalPacket.ClientRollback.parseFrom(packet.getBody());
                    MDC.put("destination", rollback.getDestination());
                    if (StringUtils.isNotEmpty(rollback.getDestination())
                        && StringUtils.isNotEmpty(rollback.getClientId())) {
                        clientIdentity = new ClientIdentity(rollback.getDestination(),
                                                            Short.valueOf(rollback.getClientId()));
                        if (rollback.getBatchId() == 0L) {
                            embededServer.rollback(clientIdentity);// 回滚所有批次
                        } else {
                            embededServer.rollback(clientIdentity, rollback.getBatchId()); // 只回滚单个批次
                        }
                    } else {
                        NettyUtils.error(401, MessageFormatter.format("destination or clientId is null",
                                                                      rollback.toString()).getMessage(),
                                         ctx.getChannel(), null);
                    }
                    break;
                default:
                    NettyUtils.error(
View Full Code Here

TOP

Related Classes of com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.