Package org.apache.thrift.protocol

Examples of org.apache.thrift.protocol.TMessage


   * Overriden super class method. Receives the service response and relays it back to the client
   * @see org.apache.thrift.TServiceClient#receiveBase(org.apache.thrift.TBase, String)
   */
  public void receiveBase(TBase result, String methodName) throws TException {
    // Read the service response - same as in TServiceClient#receiveBase
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
View Full Code Here


        if ( bis.markSupported() ) {
            bis.reset();
            bis.skip( headerLength );
        }

        TMessage message = protocol.readMessageBegin();

        Demo.echoString_args args = new Demo.echoString_args();

        args.read( protocol );
View Full Code Here

        Request request = createRequest();

        DefaultFuture future = new DefaultFuture( channel, request, 10 );

        TMessage message = new TMessage( "echoString", TMessageType.REPLY, ThriftCodec.getSeqId() );

        Demo.echoString_result methodResult = new Demo.echoString_result();

        methodResult.success = "Hello, World!";
View Full Code Here

        Request request = createRequest();

        DefaultFuture future = new DefaultFuture( channel, request, 10 );

        TMessage message = new TMessage( "echoString", TMessageType.EXCEPTION, ThriftCodec.getSeqId() );

        TTransport transport = new TIOStreamTransport( bos );

        TBinaryProtocol protocol = new TBinaryProtocol( transport );
View Full Code Here

        if ( bis.markSupported() ) {
            bis.reset();
            bis.skip( headerLength );
        }

        TMessage message = protocol.readMessageBegin();
        Assert.assertEquals( "echoString", message.name );
        Assert.assertEquals( TMessageType.REPLY, message.type );
        Assert.assertEquals( ThriftCodec.getSeqId(), message.seqid );
        Demo.echoString_result result = new Demo.echoString_result();
        result.read( protocol );
View Full Code Here

        if ( bis.markSupported() ) {
            bis.reset();
            bis.skip( headerLength );
        }

        TMessage message = protocol.readMessageBegin();
        Assert.assertEquals( "echoString", message.name );
        Assert.assertEquals( TMessageType.EXCEPTION, message.type );
        Assert.assertEquals( ThriftCodec.getSeqId(), message.seqid );
        TApplicationException exception = TApplicationException.read( protocol );
        protocol.readMessageEnd();
View Full Code Here

        headerLength = bos.size();

        Demo.echoString_args args = new Demo.echoString_args(  );
        args.setArg( "Hell, World!" );

        TMessage message = new TMessage( "echoString", TMessageType.CALL, ThriftCodec.getSeqId() );

        protocol.writeMessageBegin( message );
        args.write( protocol );
        protocol.writeMessageEnd();
        protocol.getTransport().flush();
View Full Code Here

            //Get command name
            ThriftNettyChannelBuffer ttransport = new ThriftNettyChannelBuffer(input, null);
            TProtocol iprot = this.protocolFactory.getProtocol(ttransport);
            input.markReaderIndex();
            TMessage message = iprot.readMessageBegin();
            input.resetReaderIndex();

            ThriftRequestWrapper thriftRequestWrapper = new ThriftRequestWrapper();

            thriftRequestWrapper.setClientSocket(clientTransport);
View Full Code Here

        // Note that though setting message type to ONEWAY can be helpful when looking at packet
        // captures, some clients always send CALL and so servers are forced to rely on the "oneway"
        // attribute on thrift method in the interface definition, rather than checking the message
        // type.
        out.writeMessageBegin(new TMessage(name, oneway ? ONEWAY : CALL, sequenceId));

        // write the parameters
        TProtocolWriter writer = new TProtocolWriter(out);
        writer.writeStructBegin(name + "_args");
        for (int i = 0; i < args.length; i++) {
View Full Code Here

    private void waitForResponse(TProtocol in, int sequenceId)
            throws TException
    {
        long start = nanoTime();

        TMessage message = in.readMessageBegin();
        if (message.type == EXCEPTION) {
            TApplicationException exception = TApplicationException.read(in);
            in.readMessageEnd();
            throw exception;
        }
View Full Code Here

TOP

Related Classes of org.apache.thrift.protocol.TMessage

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.