Examples of toByteString()


Examples of com.alibaba.otter.canal.protocol.CanalEntry.TransactionBegin.toByteString()

    private Entry parseQueryEvent(QueryLogEvent event) {
        String queryString = event.getQuery();
        if (StringUtils.endsWithIgnoreCase(queryString, BEGIN)) {
            TransactionBegin transactionBegin = createTransactionBegin(event.getExecTime());
            Header header = createHeader(binlogFileName, event.getHeader(), "", "", null);
            return createEntry(header, EntryType.TRANSACTIONBEGIN, transactionBegin.toByteString());
        } else if (StringUtils.endsWithIgnoreCase(queryString, COMMIT)) {
            TransactionEnd transactionEnd = createTransactionEnd(0L, event.getWhen()); // MyISAM可能不会有xid事件
            Header header = createHeader(binlogFileName, event.getHeader(), "", "", null);
            return createEntry(header, EntryType.TRANSACTIONEND, transactionEnd.toByteString());
        } else {
View Full Code Here

Examples of com.alibaba.otter.canal.protocol.CanalEntry.TransactionEnd.toByteString()

            Header header = createHeader(binlogFileName, event.getHeader(), "", "", null);
            return createEntry(header, EntryType.TRANSACTIONBEGIN, transactionBegin.toByteString());
        } else if (StringUtils.endsWithIgnoreCase(queryString, COMMIT)) {
            TransactionEnd transactionEnd = createTransactionEnd(0L, event.getWhen()); // MyISAM可能不会有xid事件
            Header header = createHeader(binlogFileName, event.getHeader(), "", "", null);
            return createEntry(header, EntryType.TRANSACTIONEND, transactionEnd.toByteString());
        } else {
            // DDL语句处理
            DdlResult result = SimpleDdlParser.parse(queryString, event.getDbName());

            String schemaName = event.getDbName();
View Full Code Here

Examples of com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.toByteString()

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

Examples of com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.toByteString()

            Handshake handshake = Handshake.parseFrom(p.getBody());
            supportedCompressions.addAll(handshake.getSupportedCompressionsList());
            //
            ClientAuth ca = ClientAuth.newBuilder().setUsername(username != null ? username : "").setNetReadTimeout(soTimeout).setNetWriteTimeout(soTimeout).build();
            writeWithHeader(channel,
                            Packet.newBuilder().setType(PacketType.CLIENTAUTHENTICATION).setBody(ca.toByteString()).build().toByteArray());
            //
            Packet ack = Packet.parseFrom(readNextPacket(channel));
            if (ack.getType() != PacketType.ACK) {
                throw new CanalClientException("unexpected packet type when ack is expected");
            }
View Full Code Here

Examples of com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.toByteString()

    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

Examples of com.chenshuo.muduo.protorpc.echo.EchoProto.EchoRequest.toByteString()

        RpcEncoder encoder = new RpcEncoder();
        EchoRequest request = EchoRequest.newBuilder().setPayload("Hello").build();
        RpcMessage message = RpcMessage.newBuilder().setType(MessageType.REQUEST).setId(1)
                .setService(EchoService.getDescriptor().getName())
                .setMethod(EchoService.getDescriptor().getMethods().get(0).getName())
                .setRequest(request.toByteString()).build();
        encoder.encode(null, null, message);
    }

    @Test
    public void testDecoder() throws Exception {
View Full Code Here

Examples of com.chenshuo.muduo.protorpc.sudoku.SudokuProto.SudokuRequest.toByteString()

        RpcEncoder encoder = new RpcEncoder();
        SudokuRequest request = SudokuRequest.newBuilder().setCheckerboard("001010").build();
        RpcMessage message = RpcMessage.newBuilder().setType(MessageType.REQUEST).setId(1)
                .setService(SudokuService.getDescriptor().getName())
                .setMethod(SudokuService.getDescriptor().getMethods().get(0).getName())
                .setRequest(request.toByteString()).build();
        ChannelBuffer buffer = (ChannelBuffer) encoder.encode(null, null, message);

        RpcDecoder decoder = new RpcDecoder();
        RpcMessage decodedMessage = (RpcMessage) decoder.decode(null, null, buffer);
        assertEquals(1, decodedMessage.getId());
View Full Code Here

Examples of com.chenshuo.muduo.protorpc.sudoku.SudokuProto.SudokuResponse.toByteString()

                .setCheckerboard("123456")
                .build();
        RpcMessage response = RpcMessage.newBuilder()
                .setType(MessageType.RESPONSE)
                .setId(1)
                .setResponse(sudokuResponse.toByteString())
                .build();
        channel.messageReceived(null, new UpstreamMessageEvent(mockChannel, response, null));
        assertEquals(sudokuResponse, gotResponse);
    }
View Full Code Here

Examples of com.google.dataconnector.protocol.proto.SdcFrame.AuthorizationInfo.toByteString()

                AuthorizationInfo authorizationResponse = AuthorizationInfo
                        .newBuilder().setResult(ResultCode.OK).build();

                getFrameSender().sendFrame(FrameInfo.Type.AUTHORIZATION,
                        authorizationResponse.toByteString());

                // Register frame dispatchers
                getFrameReceiver().registerDispatcher(Type.FETCH_REQUEST, this);
                getFrameReceiver().registerDispatcher(Type.REGISTRATION, this);
                getFrameReceiver().registerDispatcher(Type.HEALTH_CHECK, this);
View Full Code Here

Examples of com.google.dataconnector.protocol.proto.SdcFrame.FetchReply.toByteString()

     
      FrameInfo frame = sm.getSessionEncryption().toFrameInfo(
          FrameInfo.Type.FETCH_REQUEST, reply);
     
      assertTrue(frame.hasSessionId());
      assertEquals(reply.toByteString(), sm.getSessionEncryption().decrypt(frame.getPayload()));
    }

  public void testValidateFetchRequest() throws Exception {
    FetchRequest request = FetchRequest.newBuilder()
     .setId("requestId").setStrategy("HttpClient").setResource("badUrl").build();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.